From 0c70a0dcbf0ab3b45388b85dba3964b04606aef2 Mon Sep 17 00:00:00 2001 From: Geza Lore Date: Fri, 16 Sep 2022 11:22:11 +0100 Subject: [PATCH] Remove redundant 'virtual' keywords from overridden methods 'virtual' is redundant when 'override' is present, so keep only 'override'. Add t/t_dist_cppstyle.pl to check for this. --- include/verilated_fst_sc.h | 21 +- include/verilated_vcd_sc.h | 20 +- src/V3Active.cpp | 58 +- src/V3ActiveTop.cpp | 20 +- src/V3Assert.cpp | 28 +- src/V3AssertPre.cpp | 24 +- src/V3AstNodeDType.h | 646 +++--- src/V3AstNodeMath.h | 3112 ++++++++++++++--------------- src/V3AstNodeOther.h | 1014 +++++----- src/V3AstNodes.cpp | 10 +- src/V3Begin.cpp | 34 +- src/V3Branch.cpp | 10 +- src/V3Broken.cpp | 20 +- src/V3CUse.cpp | 10 +- src/V3Case.cpp | 14 +- src/V3Cast.cpp | 28 +- src/V3Cdc.cpp | 78 +- src/V3Changed.cpp | 12 +- src/V3Class.cpp | 24 +- src/V3Clean.cpp | 58 +- src/V3Clock.cpp | 22 +- src/V3Combine.cpp | 12 +- src/V3Const.cpp | 94 +- src/V3Coverage.cpp | 26 +- src/V3CoverageJoin.cpp | 10 +- src/V3Dead.cpp | 40 +- src/V3Delayed.cpp | 22 +- src/V3Depth.cpp | 20 +- src/V3DepthBlock.cpp | 14 +- src/V3Descope.cpp | 24 +- src/V3EmitCBase.h | 2 +- src/V3EmitCConstInit.h | 8 +- src/V3EmitCConstPool.cpp | 2 +- src/V3EmitCFunc.h | 188 +- src/V3EmitCHeaders.cpp | 2 +- src/V3EmitCImp.cpp | 44 +- src/V3EmitCInlines.cpp | 6 +- src/V3EmitCMain.cpp | 2 +- src/V3EmitCModel.cpp | 2 +- src/V3EmitCSyms.cpp | 22 +- src/V3EmitV.cpp | 236 ++- src/V3EmitXml.cpp | 62 +- src/V3Expand.cpp | 28 +- src/V3File.h | 20 +- src/V3Gate.cpp | 102 +- src/V3GenClk.cpp | 28 +- src/V3GraphAcyc.cpp | 14 +- src/V3GraphTest.cpp | 24 +- src/V3Hasher.cpp | 152 +- src/V3HierBlock.cpp | 10 +- src/V3Inline.cpp | 84 +- src/V3Inst.cpp | 36 +- src/V3InstrCount.cpp | 28 +- src/V3Life.cpp | 40 +- src/V3LifePost.cpp | 38 +- src/V3LinkCells.cpp | 38 +- src/V3LinkDot.cpp | 200 +- src/V3LinkInc.cpp | 40 +- src/V3LinkJump.cpp | 30 +- src/V3LinkLValue.cpp | 68 +- src/V3LinkParse.cpp | 56 +- src/V3LinkResolve.cpp | 74 +- src/V3Localize.cpp | 16 +- src/V3MergeCond.cpp | 16 +- src/V3Name.cpp | 20 +- src/V3OptionParser.cpp | 16 +- src/V3Order.cpp | 95 +- src/V3OrderGraph.h | 165 +- src/V3Param.cpp | 30 +- src/V3Partition.cpp | 16 +- src/V3PartitionGraph.h | 14 +- src/V3PreProc.cpp | 12 +- src/V3Premit.cpp | 46 +- src/V3ProtectLib.cpp | 8 +- src/V3Randomize.cpp | 14 +- src/V3Reloop.cpp | 12 +- src/V3Scope.cpp | 66 +- src/V3Simulate.h | 72 +- src/V3Slice.cpp | 16 +- src/V3Split.cpp | 116 +- src/V3SplitAs.cpp | 22 +- src/V3SplitVar.cpp | 46 +- src/V3Stats.cpp | 20 +- src/V3Subst.cpp | 24 +- src/V3TSP.cpp | 8 +- src/V3Table.cpp | 16 +- src/V3Task.cpp | 58 +- src/V3Trace.cpp | 46 +- src/V3TraceDecl.cpp | 24 +- src/V3Tristate.cpp | 70 +- src/V3Undriven.cpp | 42 +- src/V3Unknown.cpp | 32 +- src/V3Unroll.cpp | 12 +- src/V3VariableOrder.cpp | 4 +- src/V3Width.cpp | 472 +++-- src/V3WidthCommit.h | 32 +- src/V3WidthSel.cpp | 12 +- src/astgen | 12 +- test_regress/t/t_dist_cppstyle.pl | 66 + 99 files changed, 4454 insertions(+), 4525 deletions(-) create mode 100755 test_regress/t/t_dist_cppstyle.pl diff --git a/include/verilated_fst_sc.h b/include/verilated_fst_sc.h index ae0943d8b..f6546ce84 100644 --- a/include/verilated_fst_sc.h +++ b/include/verilated_fst_sc.h @@ -52,35 +52,36 @@ public: } spTrace()->set_time_resolution(sc_get_time_resolution().to_string()); } - virtual ~VerilatedFstSc() /*override*/ { close(); } + ~VerilatedFstSc() override { close(); } // METHODS /// Called by SystemC simulate() - virtual void cycle(bool delta_cycle) { + void cycle(bool delta_cycle) override { if (!delta_cycle) { this->dump(sc_time_stamp().to_double()); } } // Override VerilatedFstC. Must be called after starting simulation. - // cppcheck-suppress missingOverride // GCC won't accept override - virtual void open(const char* filename) /*override*/ VL_MT_SAFE; + // Note: this is not a virtual function in the base class, so no 'override' + virtual void open(const char* filename) VL_MT_SAFE; private: /// Fake outs for linker #ifdef NC_SYSTEMC // Cadence Incisive has these as abstract functions so we must create them - virtual void set_time_unit(int exponent10_seconds) {} // deprecated + void set_time_unit(int exponent10_seconds) override {} // deprecated #endif - virtual void set_time_unit(double v, sc_time_unit tu) {} // LCOV_EXCL_LINE + void set_time_unit(double v, sc_time_unit tu) override {} // LCOV_EXCL_LINE //-------------------------------------------------- // SystemC 2.1.v1 -#define DECL_TRACE_METHOD_A(tp) virtual void trace(const tp& object, const std::string& name); +#define DECL_TRACE_METHOD_A(tp) \ + void trace(const tp& object, const std::string& name) override; #define DECL_TRACE_METHOD_B(tp) \ - virtual void trace(const tp& object, const std::string& name, int width); + void trace(const tp& object, const std::string& name, int width) override; - virtual void write_comment(const std::string&); - virtual void trace(const unsigned int&, const std::string&, const char**); + void write_comment(const std::string&) override; + void trace(const unsigned int&, const std::string&, const char**) override; // clang-format off // Formatting matches that of sc_trace.h diff --git a/include/verilated_vcd_sc.h b/include/verilated_vcd_sc.h index a32134b23..133f70407 100644 --- a/include/verilated_vcd_sc.h +++ b/include/verilated_vcd_sc.h @@ -55,35 +55,35 @@ public: spTrace()->set_time_resolution(sc_get_time_resolution().to_string()); } /// Destruct, flush, and close the dump - virtual ~VerilatedVcdSc() /*override*/ { close(); } + ~VerilatedVcdSc() override { close(); } // METHODS - for SC kernel // Called by SystemC simulate() - virtual void cycle(bool delta_cycle) { + void cycle(bool delta_cycle) override { if (!delta_cycle) this->dump(sc_time_stamp().to_double()); } // Override VerilatedVcdC. Must be called after starting simulation. - // cppcheck-suppress missingOverride // GCC won't accept override - virtual void open(const char* filename) /*override*/ VL_MT_SAFE; + void open(const char* filename) override VL_MT_SAFE; private: // METHODS - Fake outs for linker #ifdef NC_SYSTEMC // Cadence Incisive has these as abstract functions so we must create them - virtual void set_time_unit(int exponent10_seconds) {} // deprecated + void set_time_unit(int exponent10_seconds) override {} // deprecated #endif - virtual void set_time_unit(double v, sc_time_unit tu) {} // LCOV_EXCL_LINE + void set_time_unit(double v, sc_time_unit tu) override {} // LCOV_EXCL_LINE //-------------------------------------------------- // SystemC 2.1.v1 -#define DECL_TRACE_METHOD_A(tp) virtual void trace(const tp& object, const std::string& name); +#define DECL_TRACE_METHOD_A(tp) \ + void trace(const tp& object, const std::string& name) override; #define DECL_TRACE_METHOD_B(tp) \ - virtual void trace(const tp& object, const std::string& name, int width); + void trace(const tp& object, const std::string& name, int width) override; - virtual void write_comment(const std::string&); - virtual void trace(const unsigned int&, const std::string&, const char**); + void write_comment(const std::string&) override; + void trace(const unsigned int&, const std::string&, const char**) override; // clang-format off // Formatting matches that of sc_trace.h diff --git a/src/V3Active.cpp b/src/V3Active.cpp index fa629c11f..f1b325eac 100644 --- a/src/V3Active.cpp +++ b/src/V3Active.cpp @@ -66,8 +66,8 @@ public: : V3GraphVertex{graphp} , m_name{name} , m_type{type} {} - virtual string name() const override { return m_name + " " + typestr(); } - virtual string dotColor() const override { return user() ? "green" : "black"; } + string name() const override { return m_name + " " + typestr(); } + string dotColor() const override { return user() ? "green" : "black"; } virtual int type() const { return m_type; } }; @@ -120,7 +120,7 @@ protected: public: LatchDetectGraph() { clear(); } - virtual ~LatchDetectGraph() override { clear(); } + ~LatchDetectGraph() override { clear(); } // ACCESSORS LatchDetectGraphVertex* currentp() { return m_curVertexp; } void currentp(LatchDetectGraphVertex* vertex) { m_curVertexp = vertex; } @@ -219,7 +219,7 @@ private: m_scopep->addActivep(nodep); } // VISITORS - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { m_scopep = nodep; m_iActivep = nullptr; m_cActivep = nullptr; @@ -227,13 +227,13 @@ private: iterateChildren(nodep); // Don't clear scopep, the namer persists beyond this visit } - virtual void visit(AstSenTree* nodep) override { + void visit(AstSenTree* nodep) override { // Simplify sensitivity list VL_DO_DANGLING(V3Const::constifyExpensiveEdit(nodep), nodep); } //-------------------- - virtual void visit(AstNodeStmt*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeStmt*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // METHODS @@ -275,7 +275,7 @@ public: // CONSTRUCTORS ActiveNamer() = default; - virtual ~ActiveNamer() override = default; + ~ActiveNamer() override = default; void main(AstScope* nodep) { iterate(nodep); } }; @@ -291,13 +291,13 @@ private: // STATE LatchDetectGraph m_graph; // Graph used to detect latches in combo always // VISITORS - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { const AstVar* const varp = nodep->varp(); if (nodep->access().isWriteOrRW() && varp->isSignal() && !varp->isUsedLoopIdx()) { m_graph.addAssignment(nodep); } } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { if (!nodep->isBoundsCheck()) { LatchDetectGraphVertex* const parentp = m_graph.currentp(); LatchDetectGraphVertex* const branchp = m_graph.addPathVertex(parentp, "BRANCH", true); @@ -309,7 +309,7 @@ private: } } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -333,7 +333,7 @@ private: const CheckType m_check; // Process type we are checking // VISITORS - virtual void visit(AstAssignDly* nodep) override { + void visit(AstAssignDly* nodep) override { // Non-blocking assignments are OK in sequential processes if (m_check == CT_SEQ) return; @@ -357,7 +357,7 @@ private: VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstAssign* nodep) override { + void visit(AstAssign* nodep) override { // Blocking assignments are always OK in combinational (and initial/final) processes if (m_check != CT_SEQ) return; @@ -380,7 +380,7 @@ private: } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -407,7 +407,7 @@ private: bool m_itemSequent = false; // Found a SenItem sequential // VISITORS - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { // Create required actives and add to scope UINFO(4, " SCOPE " << nodep << endl); // Clear last scope's names, and collect this scope's existing names @@ -415,10 +415,10 @@ private: m_scopeFinalp = nullptr; iterateChildren(nodep); } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { // Actives are being formed, so we can ignore any already made } - virtual void visit(AstInitialStatic* nodep) override { + void visit(AstInitialStatic* nodep) override { // Relink to IACTIVE, unless already under it UINFO(4, " INITIAL " << nodep << endl); const ActiveDlyVisitor dlyvisitor{nodep, ActiveDlyVisitor::CT_INITIAL}; @@ -426,7 +426,7 @@ private: nodep->unlinkFrBack(); wantactivep->addStmtsp(nodep); } - virtual void visit(AstInitial* nodep) override { + void visit(AstInitial* nodep) override { // Relink to IACTIVE, unless already under it UINFO(4, " INITIAL " << nodep << endl); const ActiveDlyVisitor dlyvisitor{nodep, ActiveDlyVisitor::CT_INITIAL}; @@ -434,28 +434,28 @@ private: nodep->unlinkFrBack(); wantactivep->addStmtsp(nodep); } - virtual void visit(AstAssignAlias* nodep) override { + void visit(AstAssignAlias* nodep) override { // Relink to CACTIVE, unless already under it UINFO(4, " ASSIGNW " << nodep << endl); AstActive* const wantactivep = m_namer.getCActive(nodep->fileline()); nodep->unlinkFrBack(); wantactivep->addStmtsp(nodep); } - virtual void visit(AstAssignW* nodep) override { + void visit(AstAssignW* nodep) override { // Relink to CACTIVE, unless already under it UINFO(4, " ASSIGNW " << nodep << endl); AstActive* const wantactivep = m_namer.getCActive(nodep->fileline()); nodep->unlinkFrBack(); wantactivep->addStmtsp(nodep); } - virtual void visit(AstCoverToggle* nodep) override { + void visit(AstCoverToggle* nodep) override { // Relink to CACTIVE, unless already under it UINFO(4, " COVERTOGGLE " << nodep << endl); AstActive* const wantactivep = m_namer.getCActive(nodep->fileline()); nodep->unlinkFrBack(); wantactivep->addStmtsp(nodep); } - virtual void visit(AstFinal* nodep) override { + void visit(AstFinal* nodep) override { // Relink to CFUNC for the final UINFO(4, " FINAL " << nodep << endl); if (!nodep->bodysp()) { // Empty, Kill it. @@ -537,7 +537,7 @@ private: ActiveDlyVisitor{nodep, ActiveDlyVisitor::CT_SEQ}; } } - virtual void visit(AstAlways* nodep) override { + void visit(AstAlways* nodep) override { // Move always to appropriate ACTIVE based on its sense list UINFO(4, " ALW " << nodep << endl); // if (debug() >= 9) nodep->dumpTree(cout, " Alw: "); @@ -549,7 +549,7 @@ private: } visitAlways(nodep, nodep->sensesp(), nodep->keyword()); } - virtual void visit(AstAlwaysPostponed* nodep) override { + void visit(AstAlwaysPostponed* nodep) override { UINFO(4, " ALW " << nodep << endl); if (!nodep->bodysp()) { VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); @@ -557,13 +557,13 @@ private: } visitAlways(nodep, nullptr, VAlwaysKwd::ALWAYS); } - virtual void visit(AstAlwaysPublic* nodep) override { + void visit(AstAlwaysPublic* nodep) override { // Move always to appropriate ACTIVE based on its sense list UINFO(4, " ALWPub " << nodep << endl); // if (debug() >= 9) nodep->dumpTree(cout, " Alw: "); visitAlways(nodep, nodep->sensesp(), VAlwaysKwd::ALWAYS); } - virtual void visit(AstSenItem* nodep) override { + void visit(AstSenItem* nodep) override { if (nodep->varrefp()) { if (const AstBasicDType* const basicp = nodep->varrefp()->dtypep()->basicp()) { if (basicp->isEventValue()) { @@ -592,9 +592,9 @@ private: } //-------------------- - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstVarScope*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstVarScope*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS diff --git a/src/V3ActiveTop.cpp b/src/V3ActiveTop.cpp index e39742dbd..dc1abe61c 100644 --- a/src/V3ActiveTop.cpp +++ b/src/V3ActiveTop.cpp @@ -52,13 +52,13 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { // Create required actives and add to module // We can start ordering at a module, or a scope UINFO(4, " MOD " << nodep << endl); iterateChildren(nodep); } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { UINFO(4, " ACTIVE " << nodep << endl); // Remove duplicate clocks and such; sensesp() may change! V3Const::constifyExpensiveEdit(nodep); @@ -101,27 +101,27 @@ private: // No need to do statements under it, they're already moved. // iterateChildren(nodep); } - virtual void visit(AstNodeProcedure* nodep) override { // LCOV_EXCL_LINE + void visit(AstNodeProcedure* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc("Node should have been under ACTIVE"); } - virtual void visit(AstAssignAlias* nodep) override { // LCOV_EXCL_LINE + void visit(AstAssignAlias* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc("Node should have been under ACTIVE"); } - virtual void visit(AstAssignW* nodep) override { // LCOV_EXCL_LINE + void visit(AstAssignW* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc("Node should have been under ACTIVE"); } - virtual void visit(AstAlwaysPublic* nodep) override { // LCOV_EXCL_LINE + void visit(AstAlwaysPublic* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc("Node should have been under ACTIVE"); } //-------------------- - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstVarScope*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstVarScope*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit ActiveTopVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~ActiveTopVisitor() override = default; + ~ActiveTopVisitor() override = default; }; //###################################################################### diff --git a/src/V3Assert.cpp b/src/V3Assert.cpp index 86e8710a8..59158a07b 100644 --- a/src/V3Assert.cpp +++ b/src/V3Assert.cpp @@ -196,7 +196,7 @@ private: } // VISITORS - virtual void visit(AstIf* nodep) override { + void visit(AstIf* nodep) override { if (nodep->user1SetOnce()) return; if (nodep->uniquePragma() || nodep->unique0Pragma()) { const AstNodeIf* ifp = nodep; @@ -254,7 +254,7 @@ private: } //========== Case assertions - virtual void visit(AstCase* nodep) override { + void visit(AstCase* nodep) override { iterateChildren(nodep); if (!nodep->user1SetOnce()) { bool has_default = false; @@ -323,7 +323,7 @@ private: } //========== Past - virtual void visit(AstPast* nodep) override { + void visit(AstPast* nodep) override { iterateChildren(nodep); uint32_t ticks = 1; if (nodep->ticksp()) { @@ -353,13 +353,13 @@ private: } nodep->replaceWith(inp); } - virtual void visit(AstSampled* nodep) override { + void visit(AstSampled* nodep) override { nodep->replaceWith(nodep->exprp()->unlinkFrBack()); VL_DO_DANGLING(pushDeletep(nodep), nodep); } //========== Statements - virtual void visit(AstDisplay* nodep) override { + void visit(AstDisplay* nodep) override { iterateChildren(nodep); // Replace the special types with standard text if (nodep->displayType() == VDisplayType::DT_INFO) { @@ -410,32 +410,32 @@ private: m_modp->addStmtp(newp); } } - virtual void visit(AstMonitorOff* nodep) override { + void visit(AstMonitorOff* nodep) override { const auto newp = new AstAssign(nodep->fileline(), newMonitorOffVarRefp(nodep, VAccess::WRITE), new AstConst(nodep->fileline(), AstConst::BitTrue{}, nodep->off())); nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstAssert* nodep) override { + void visit(AstAssert* nodep) override { iterateChildren(nodep); newPslAssertion(nodep, nodep->failsp()); } - virtual void visit(AstAssertIntrinsic* nodep) override { + void visit(AstAssertIntrinsic* nodep) override { iterateChildren(nodep); newPslAssertion(nodep, nodep->failsp()); } - virtual void visit(AstCover* nodep) override { + void visit(AstCover* nodep) override { iterateChildren(nodep); newPslAssertion(nodep, nullptr); } - virtual void visit(AstRestrict* nodep) override { + void visit(AstRestrict* nodep) override { iterateChildren(nodep); // IEEE says simulator ignores these VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); VL_RESTORER(m_modPastNum); VL_RESTORER(m_modStrobeNum); @@ -446,7 +446,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstBegin* nodep) override { + void visit(AstBegin* nodep) override { // This code is needed rather than a visitor in V3Begin, // because V3Assert is called before V3Begin VL_RESTORER(m_beginp); @@ -456,12 +456,12 @@ private: } } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit AssertVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~AssertVisitor() override { + ~AssertVisitor() override { V3Stats::addStat("Assertions, assert non-immediate statements", m_statAsNotImm); V3Stats::addStat("Assertions, assert immediate statements", m_statAsImm); V3Stats::addStat("Assertions, cover statements", m_statCover); diff --git a/src/V3AssertPre.cpp b/src/V3AssertPre.cpp index 705dfcbb2..e993bd432 100644 --- a/src/V3AssertPre.cpp +++ b/src/V3AssertPre.cpp @@ -69,7 +69,7 @@ private: // VISITORS //========== Statements - virtual void visit(AstClocking* nodep) override { + void visit(AstClocking* nodep) override { UINFO(8, " CLOCKING" << nodep << endl); // Store the new default clock, reset on new module m_seniDefaultp = nodep->sensesp(); @@ -81,14 +81,14 @@ private: } VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstAlways* nodep) override { + void visit(AstAlways* nodep) override { iterateAndNextNull(nodep->sensesp()); if (nodep->sensesp()) m_seniAlwaysp = nodep->sensesp()->sensesp(); iterateAndNextNull(nodep->bodysp()); m_seniAlwaysp = nullptr; } - virtual void visit(AstNodeCoverOrAssert* nodep) override { + void visit(AstNodeCoverOrAssert* nodep) override { if (nodep->sentreep()) return; // Already processed clearAssertInfo(); // Find Clocking's buried under nodep->exprsp @@ -96,7 +96,7 @@ private: if (!nodep->immediate()) nodep->sentreep(newSenTree(nodep)); clearAssertInfo(); } - virtual void visit(AstFell* nodep) override { + void visit(AstFell* nodep) override { if (nodep->sentreep()) return; // Already processed iterateChildren(nodep); FileLine* const fl = nodep->fileline(); @@ -110,12 +110,12 @@ private: nodep->sentreep(newSenTree(nodep)); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstPast* nodep) override { + void visit(AstPast* nodep) override { if (nodep->sentreep()) return; // Already processed iterateChildren(nodep); nodep->sentreep(newSenTree(nodep)); } - virtual void visit(AstRose* nodep) override { + void visit(AstRose* nodep) override { if (nodep->sentreep()) return; // Already processed iterateChildren(nodep); FileLine* const fl = nodep->fileline(); @@ -129,7 +129,7 @@ private: nodep->sentreep(newSenTree(nodep)); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstStable* nodep) override { + void visit(AstStable* nodep) override { if (nodep->sentreep()) return; // Already processed iterateChildren(nodep); FileLine* const fl = nodep->fileline(); @@ -143,7 +143,7 @@ private: VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstImplication* nodep) override { + void visit(AstImplication* nodep) override { if (nodep->sentreep()) return; // Already processed FileLine* const fl = nodep->fileline(); @@ -161,7 +161,7 @@ private: VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstPropClocked* nodep) override { + void visit(AstPropClocked* nodep) override { // No need to iterate the body, once replace will get iterated iterateAndNextNull(nodep->sensesp()); if (m_senip) @@ -183,12 +183,12 @@ private: nodep->replaceWith(blockp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { iterateChildren(nodep); // Reset defaults m_seniDefaultp = nullptr; } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -197,7 +197,7 @@ public: // Process iterate(nodep); } - virtual ~AssertPreVisitor() override = default; + ~AssertPreVisitor() override = default; }; //###################################################################### diff --git a/src/V3AstNodeDType.h b/src/V3AstNodeDType.h index 3615650af..8df86afab 100644 --- a/src/V3AstNodeDType.h +++ b/src/V3AstNodeDType.h @@ -52,9 +52,9 @@ protected: public: ASTGEN_MEMBERS_NodeDType; // ACCESSORS - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; virtual void dumpSmall(std::ostream& str) const; - virtual bool hasDType() const override { return true; } + bool hasDType() const override { return true; } /// Require VlUnpacked, instead of [] for POD elements. /// A non-POD object is always compound, but some POD elements /// are compound when methods calls operate on object, or when @@ -72,7 +72,7 @@ public: virtual int widthAlignBytes() const = 0; // (Slow) recurses - Width in bytes rounding up 1,2,4,8,12,... virtual int widthTotalBytes() const = 0; - virtual bool maybePointedTo() const override { return true; } + bool maybePointedTo() const override { return true; } // Iff has a non-null refDTypep(), as generic node function virtual AstNodeDType* virtRefDTypep() const { return nullptr; } // Iff has refDTypep(), set as generic node function @@ -143,47 +143,45 @@ protected: public: ASTGEN_MEMBERS_NodeArrayDType; - virtual void dump(std::ostream& str) const override; - virtual void dumpSmall(std::ostream& str) const override; - virtual const char* broken() const override { + void dump(std::ostream& str) const override; + void dumpSmall(std::ostream& str) const override; + const char* broken() const override { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep(); } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstNodeArrayDType* const asamep = static_cast(samep); return (hi() == asamep->hi() && subDTypep() == asamep->subDTypep() && rangenp()->sameTree(asamep->rangenp())); } // HashedDT doesn't recurse, so need to check children - virtual bool similarDType(AstNodeDType* samep) const override { + bool similarDType(AstNodeDType* samep) const override { const AstNodeArrayDType* const asamep = static_cast(samep); return (asamep && type() == samep->type() && hi() == asamep->hi() && rangenp()->sameTree(asamep->rangenp()) && subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp())); } - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + AstNodeDType* getChildDTypep() const override { return childDTypep(); } AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } - virtual AstNodeDType* subDTypep() const override { - return m_refDTypep ? m_refDTypep : childDTypep(); - } + AstNodeDType* subDTypep() const override { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } - virtual AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } - virtual void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } + AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } + void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } AstRange* rangep() const { return VN_AS(op2p(), Range); } // op2 = Array(s) of variable void rangep(AstRange* nodep); // METHODS - virtual AstBasicDType* basicp() const override { + AstBasicDType* basicp() const override { return subDTypep()->basicp(); } // (Slow) recurse down to find basic data type - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } - virtual int widthTotalBytes() const override { + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } + int widthTotalBytes() const override { return elementsConst() * subDTypep()->widthTotalBytes(); } int left() const; @@ -217,30 +215,30 @@ protected: public: ASTGEN_MEMBERS_NodeUOrStructDType; int uniqueNum() const { return m_uniqueNum; } - virtual const char* broken() const override; - virtual void dump(std::ostream& str) const override; - virtual bool isCompound() const override { return false; } // Because don't support unpacked + const char* broken() const override; + void dump(std::ostream& str) const override; + bool isCompound() const override { return false; } // Because don't support unpacked // For basicp() we reuse the size to indicate a "fake" basic type of same size - virtual AstBasicDType* basicp() const override { + AstBasicDType* basicp() const override { return (isFourstate() ? VN_AS(findLogicRangeDType(VNumRange{width() - 1, 0}, width(), numeric()), BasicDType) : VN_AS(findBitRangeDType(VNumRange{width() - 1, 0}, width(), numeric()), BasicDType)); } - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } // (Slow) recurses - Structure alignment 1,2,4 or 8 bytes (arrays affect this) - virtual int widthAlignBytes() const override; + int widthAlignBytes() const override; // (Slow) recurses - Width in bytes rounding up 1,2,4,8,12,... - virtual int widthTotalBytes() const override; + int widthTotalBytes() const override; // op1 = members - virtual bool similarDType(AstNodeDType* samep) const override { + bool similarDType(AstNodeDType* samep) const override { return this == samep; // We don't compare members, require exact equivalence } - virtual string name() const override { return m_name; } - virtual void name(const string& flag) override { m_name = flag; } + string name() const override { return m_name; } + void name(const string& flag) override { m_name = flag; } AstMemberDType* membersp() const { return VN_AS(op1p(), MemberDType); } // op1 = AstMember list @@ -249,7 +247,7 @@ public: // packed() but as don't support unpacked, presently all structs static bool packedUnsup() { return true; } void isFourstate(bool flag) { m_isFourstate = flag; } - virtual bool isFourstate() const override { return m_isFourstate; } + bool isFourstate() const override { return m_isFourstate; } void clearCache() { m_members.clear(); } void repairMemberCache(); AstMemberDType* findMember(const string& name) const { @@ -277,10 +275,10 @@ public: addNOp2p(initp); } ASTGEN_MEMBERS_EnumItem; - virtual string name() const override { return m_name; } - virtual bool maybePointedTo() const override { return true; } - virtual bool hasDType() const override { return true; } - virtual void name(const string& flag) override { m_name = flag; } + string name() const override { return m_name; } + bool maybePointedTo() const override { return true; } + bool hasDType() const override { return true; } + void name(const string& flag) override { m_name = flag; } AstRange* rangep() const { return VN_AS(op1p(), Range); } // op1 = Range for name appending void rangep(AstRange* nodep) { addOp1p((AstNode*)nodep); } AstNode* valuep() const { return op2p(); } // op2 = Value @@ -311,43 +309,41 @@ public: dtypep(dtp); } ASTGEN_MEMBERS_AssocArrayDType; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); BROKEN_RTN(!((m_keyDTypep && !childDTypep() && m_keyDTypep->brokeExists()) || (!m_keyDTypep && childDTypep()))); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep(); if (m_keyDTypep && m_keyDTypep->clonep()) m_keyDTypep = m_keyDTypep->clonep(); } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstAssocArrayDType* const asamep = static_cast(samep); if (!asamep->subDTypep()) return false; if (!asamep->keyDTypep()) return false; return (subDTypep() == asamep->subDTypep() && keyDTypep() == asamep->keyDTypep()); } - virtual bool similarDType(AstNodeDType* samep) const override { + bool similarDType(AstNodeDType* samep) const override { const AstAssocArrayDType* const asamep = static_cast(samep); return type() == samep->type() && asamep->subDTypep() && subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp()); } - virtual string prettyDTypeName() const override; - virtual void dumpSmall(std::ostream& str) const override; - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } - virtual AstNodeDType* getChild2DTypep() const override { return keyChildDTypep(); } + string prettyDTypeName() const override; + void dumpSmall(std::ostream& str) const override; + AstNodeDType* getChildDTypep() const override { return childDTypep(); } + AstNodeDType* getChild2DTypep() const override { return keyChildDTypep(); } // op1 = Range of variable AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } - virtual AstNodeDType* subDTypep() const override { - return m_refDTypep ? m_refDTypep : childDTypep(); - } + AstNodeDType* subDTypep() const override { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } - virtual AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } - virtual void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } - virtual AstNodeDType* virtRefDType2p() const override { return m_keyDTypep; } - virtual void virtRefDType2p(AstNodeDType* nodep) override { keyDTypep(nodep); } + AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } + void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } + AstNodeDType* virtRefDType2p() const override { return m_keyDTypep; } + void virtRefDType2p(AstNodeDType* nodep) override { keyDTypep(nodep); } // AstNodeDType* keyDTypep() const { return m_keyDTypep ? m_keyDTypep : keyChildDTypep(); } void keyDTypep(AstNodeDType* nodep) { m_keyDTypep = nodep; } @@ -355,13 +351,13 @@ public: AstNodeDType* keyChildDTypep() const { return VN_AS(op2p(), NodeDType); } void keyChildDTypep(AstNodeDType* nodep) { setOp2p(nodep); } // METHODS - virtual AstBasicDType* basicp() const override { return nullptr; } - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } - virtual int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } - virtual bool isCompound() const override { return true; } + AstBasicDType* basicp() const override { return nullptr; } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } + int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } + bool isCompound() const override { return true; } }; class AstBasicDType final : public AstNodeDType { // Builtin atomic/vectored data type @@ -404,18 +400,18 @@ private: public: ASTGEN_MEMBERS_BasicDType; - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; // width/widthMin/numeric compared elsewhere - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstBasicDType* const sp = static_cast(samep); return m == sp->m; } - virtual bool similarDType(AstNodeDType* samep) const override { + bool similarDType(AstNodeDType* samep) const override { return type() == samep->type() && same(samep); } - virtual string name() const override { return m.m_keyword.ascii(); } - virtual string prettyDTypeName() const override; - virtual const char* broken() const override { + string name() const override { return m.m_keyword.ascii(); } + string prettyDTypeName() const override; + const char* broken() const override { BROKEN_RTN(dtypep() != this); return nullptr; } @@ -430,15 +426,15 @@ public: } } // METHODS - virtual AstBasicDType* basicp() const override { return (AstBasicDType*)this; } - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + AstBasicDType* basicp() const override { return (AstBasicDType*)this; } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } // (Slow) recurses - Structure alignment 1,2,4 or 8 bytes (arrays affect this) - virtual int widthAlignBytes() const override; + int widthAlignBytes() const override; // (Slow) recurses - Width in bytes rounding up 1,2,4,8,12,... - virtual int widthTotalBytes() const override; - virtual bool isFourstate() const override { return keyword().isFourstate(); } + int widthTotalBytes() const override; + bool isFourstate() const override { return keyword().isFourstate(); } VBasicDTypeKwd keyword() const { // Avoid using - use isSomething accessors instead return m.m_keyword; } @@ -469,7 +465,7 @@ public: bool implicit() const { return keyword() == VBasicDTypeKwd::LOGIC_IMPLICIT; } VNumRange declRange() const { return isRanged() ? VNumRange{left(), right()} : VNumRange{}; } void cvtRangeConst(); // Convert to smaller representation - virtual bool isCompound() const override { return isString(); } + bool isCompound() const override { return isString(); } }; class AstBracketArrayDType final : public AstNodeDType { // Associative/Queue/Normal array data type, ie "[dtype_or_expr]" @@ -483,23 +479,23 @@ public: setOp2p(elementsp); // Only for parser } ASTGEN_MEMBERS_BracketArrayDType; - virtual bool similarDType(AstNodeDType* samep) const override { V3ERROR_NA_RETURN(false); } + bool similarDType(AstNodeDType* samep) const override { V3ERROR_NA_RETURN(false); } // op1 = Range of variable AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } - virtual AstNodeDType* subDTypep() const override { return childDTypep(); } + AstNodeDType* subDTypep() const override { return childDTypep(); } // op2 = Range of variable AstNode* elementsp() const { return op2p(); } // METHODS // Will be removed in V3Width, which relies on this // being a child not a dtype pointed node - virtual bool maybePointedTo() const override { return false; } - virtual AstBasicDType* basicp() const override { return nullptr; } - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { V3ERROR_NA_RETURN(0); } - virtual int widthTotalBytes() const override { V3ERROR_NA_RETURN(0); } - virtual bool isCompound() const override { return true; } + bool maybePointedTo() const override { return false; } + AstBasicDType* basicp() const override { return nullptr; } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { V3ERROR_NA_RETURN(0); } + int widthTotalBytes() const override { V3ERROR_NA_RETURN(0); } + bool isCompound() const override { return true; } }; class AstClassRefDType final : public AstNodeDType { // Reference to a class @@ -518,31 +514,31 @@ public: // METHODS const char* broken() const override; void cloneRelink() override; - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstClassRefDType* const asamep = static_cast(samep); return (m_classp == asamep->m_classp && m_classOrPackagep == asamep->m_classOrPackagep); } - virtual bool similarDType(AstNodeDType* samep) const override { + bool similarDType(AstNodeDType* samep) const override { return this == samep || (type() == samep->type() && same(samep)); } - virtual void dump(std::ostream& str = std::cout) const override; - virtual void dumpSmall(std::ostream& str) const override; + void dump(std::ostream& str = std::cout) const override; + void dumpSmall(std::ostream& str) const override; string name() const override; - virtual AstBasicDType* basicp() const override { return nullptr; } - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return 0; } - virtual int widthTotalBytes() const override { return 0; } - virtual AstNodeDType* virtRefDTypep() const override { return nullptr; } - virtual void virtRefDTypep(AstNodeDType* nodep) override {} - virtual AstNodeDType* subDTypep() const override { return nullptr; } + AstBasicDType* basicp() const override { return nullptr; } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return 0; } + int widthTotalBytes() const override { return 0; } + AstNodeDType* virtRefDTypep() const override { return nullptr; } + void virtRefDTypep(AstNodeDType* nodep) override {} + AstNodeDType* subDTypep() const override { return nullptr; } AstNodeModule* classOrPackagep() const { return m_classOrPackagep; } void classOrPackagep(AstNodeModule* nodep) { m_classOrPackagep = nodep; } AstClass* classp() const { return m_classp; } void classp(AstClass* nodep) { m_classp = nodep; } AstPin* paramsp() const { return VN_AS(op4p(), Pin); } - virtual bool isCompound() const override { return true; } + bool isCompound() const override { return true; } }; class AstConstDType final : public AstNodeDType { // const data type, ie "const some_dtype var_name [2:0]" @@ -559,39 +555,37 @@ public: widthFromSub(subDTypep()); } ASTGEN_MEMBERS_ConstDType; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep(); } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstConstDType* const sp = static_cast(samep); return (m_refDTypep == sp->m_refDTypep); } - virtual bool similarDType(AstNodeDType* samep) const override { + bool similarDType(AstNodeDType* samep) const override { return skipRefp()->similarDType(samep->skipRefp()); } - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + AstNodeDType* getChildDTypep() const override { return childDTypep(); } // op1 = Range of variable AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } - virtual AstNodeDType* subDTypep() const override { - return m_refDTypep ? m_refDTypep : childDTypep(); - } + AstNodeDType* subDTypep() const override { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } - virtual AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } - virtual void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } + AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } + void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } // METHODS - virtual AstBasicDType* basicp() const override { return subDTypep()->basicp(); } - virtual AstNodeDType* skipRefp() const override { return subDTypep()->skipRefp(); } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return subDTypep()->skipRefToEnump(); } - virtual int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } - virtual int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } - virtual bool isCompound() const override { + AstBasicDType* basicp() const override { return subDTypep()->basicp(); } + AstNodeDType* skipRefp() const override { return subDTypep()->skipRefp(); } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return subDTypep()->skipRefToEnump(); } + int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } + int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } + bool isCompound() const override { v3fatalSrc("call isCompound on subdata type, not reference"); return false; } @@ -618,33 +612,31 @@ public: } ASTGEN_MEMBERS_DefImplicitDType; int uniqueNum() const { return m_uniqueNum; } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstDefImplicitDType* const sp = static_cast(samep); return uniqueNum() == sp->uniqueNum(); } - virtual bool similarDType(AstNodeDType* samep) const override { + bool similarDType(AstNodeDType* samep) const override { return type() == samep->type() && same(samep); } - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + AstNodeDType* getChildDTypep() const override { return childDTypep(); } // op1 = Range of variable AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } - virtual AstNodeDType* subDTypep() const override { - return dtypep() ? dtypep() : childDTypep(); - } + AstNodeDType* subDTypep() const override { return dtypep() ? dtypep() : childDTypep(); } void* containerp() const { return m_containerp; } // METHODS // op1 = Range of variable AstNodeDType* dtypeSkipRefp() const { return dtypep()->skipRefp(); } - virtual AstBasicDType* basicp() const override { return subDTypep()->basicp(); } - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return dtypep()->widthAlignBytes(); } - virtual int widthTotalBytes() const override { return dtypep()->widthTotalBytes(); } - virtual string name() const override { return m_name; } - virtual void name(const string& flag) override { m_name = flag; } - virtual bool isCompound() const override { return false; } + AstBasicDType* basicp() const override { return subDTypep()->basicp(); } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return dtypep()->widthAlignBytes(); } + int widthTotalBytes() const override { return dtypep()->widthTotalBytes(); } + string name() const override { return m_name; } + void name(const string& flag) override { m_name = flag; } + bool isCompound() const override { return false; } }; class AstDynArrayDType final : public AstNodeDType { // Dynamic array data type, ie "[]" @@ -664,44 +656,42 @@ public: dtypep(nullptr); // V3Width will resolve } ASTGEN_MEMBERS_DynArrayDType; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep(); } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstAssocArrayDType* const asamep = static_cast(samep); if (!asamep->subDTypep()) return false; return subDTypep() == asamep->subDTypep(); } - virtual bool similarDType(AstNodeDType* samep) const override { + bool similarDType(AstNodeDType* samep) const override { const AstAssocArrayDType* const asamep = static_cast(samep); return type() == samep->type() && asamep->subDTypep() && subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp()); } - virtual string prettyDTypeName() const override; - virtual void dumpSmall(std::ostream& str) const override; - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + string prettyDTypeName() const override; + void dumpSmall(std::ostream& str) const override; + AstNodeDType* getChildDTypep() const override { return childDTypep(); } // op1 = Range of variable AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } - virtual AstNodeDType* subDTypep() const override { - return m_refDTypep ? m_refDTypep : childDTypep(); - } + AstNodeDType* subDTypep() const override { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } - virtual AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } - virtual void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } + AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } + void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } // METHODS - virtual AstBasicDType* basicp() const override { return nullptr; } - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } - virtual int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } - virtual bool isCompound() const override { return true; } + AstBasicDType* basicp() const override { return nullptr; } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } + int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } + bool isCompound() const override { return true; } }; class AstEmptyQueueDType final : public AstNodeDType { // For EmptyQueue @@ -711,24 +701,24 @@ public: dtypep(this); } ASTGEN_MEMBERS_EmptyQueueDType; - virtual void dumpSmall(std::ostream& str) const override; - virtual bool hasDType() const override { return true; } - virtual bool maybePointedTo() const override { return true; } - virtual bool undead() const override { return true; } - virtual AstNodeDType* subDTypep() const override { return nullptr; } - virtual AstNodeDType* virtRefDTypep() const override { return nullptr; } - virtual void virtRefDTypep(AstNodeDType* nodep) override {} - virtual bool similarDType(AstNodeDType* samep) const override { return this == samep; } - virtual AstBasicDType* basicp() const override { return nullptr; } + void dumpSmall(std::ostream& str) const override; + bool hasDType() const override { return true; } + bool maybePointedTo() const override { return true; } + bool undead() const override { return true; } + AstNodeDType* subDTypep() const override { return nullptr; } + AstNodeDType* virtRefDTypep() const override { return nullptr; } + void virtRefDTypep(AstNodeDType* nodep) override {} + bool similarDType(AstNodeDType* samep) const override { return this == samep; } + AstBasicDType* basicp() const override { return nullptr; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return 1; } - virtual int widthTotalBytes() const override { return 1; } - virtual bool isCompound() const override { return false; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return 1; } + int widthTotalBytes() const override { return 1; } + bool isCompound() const override { return false; } }; class AstEnumDType final : public AstNodeDType { // Parents: TYPEDEF/MODULE @@ -749,49 +739,45 @@ public: widthFromSub(subDTypep()); } ASTGEN_MEMBERS_EnumDType; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep(); } int uniqueNum() const { return m_uniqueNum; } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstEnumDType* const sp = static_cast(samep); return uniqueNum() == sp->uniqueNum(); } - virtual bool similarDType(AstNodeDType* samep) const override { return this == samep; } - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + bool similarDType(AstNodeDType* samep) const override { return this == samep; } + AstNodeDType* getChildDTypep() const override { return childDTypep(); } AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } // op1 = Data type void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } // op1 = Range of variable - virtual AstNodeDType* subDTypep() const override { - return m_refDTypep ? m_refDTypep : childDTypep(); - } + AstNodeDType* subDTypep() const override { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } - virtual AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } - virtual void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } - virtual string name() const override { return m_name; } - virtual void name(const string& flag) override { m_name = flag; } + AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } + void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } + string name() const override { return m_name; } + void name(const string& flag) override { m_name = flag; } AstEnumItem* itemsp() const { return VN_AS(op2p(), EnumItem); } // op2 = AstEnumItem's // METHODS - virtual AstBasicDType* basicp() const override { return subDTypep()->basicp(); } - virtual AstNodeDType* skipRefp() const override { return subDTypep()->skipRefp(); } - virtual AstNodeDType* skipRefToConstp() const override { - return subDTypep()->skipRefToConstp(); - } + AstBasicDType* basicp() const override { return subDTypep()->basicp(); } + AstNodeDType* skipRefp() const override { return subDTypep()->skipRefp(); } + AstNodeDType* skipRefToConstp() const override { return subDTypep()->skipRefToConstp(); } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } - virtual int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } + int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } int itemCount() const { size_t count = 0; for (AstNode* itemp = itemsp(); itemp; itemp = itemp->nextp()) count++; return count; } - virtual bool isCompound() const override { return false; } + bool isCompound() const override { return false; } }; class AstIfaceRefDType final : public AstNodeDType { // Reference to an interface, either for a port, or inside parent cell @@ -819,17 +805,17 @@ public: , m_modportName{modport} {} ASTGEN_MEMBERS_IfaceRefDType; // METHODS - virtual const char* broken() const override; - virtual void dump(std::ostream& str = std::cout) const override; - virtual void dumpSmall(std::ostream& str) const override; - virtual void cloneRelink() override; - virtual AstBasicDType* basicp() const override { return nullptr; } - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual bool similarDType(AstNodeDType* samep) const override { return this == samep; } - virtual int widthAlignBytes() const override { return 1; } - virtual int widthTotalBytes() const override { return 1; } + const char* broken() const override; + void dump(std::ostream& str = std::cout) const override; + void dumpSmall(std::ostream& str) const override; + void cloneRelink() override; + AstBasicDType* basicp() const override { return nullptr; } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + bool similarDType(AstNodeDType* samep) const override { return this == samep; } + int widthAlignBytes() const override { return 1; } + int widthTotalBytes() const override { return 1; } FileLine* modportFileline() const { return m_modportFileline; } string cellName() const { return m_cellName; } void cellName(const string& name) { m_cellName = name; } @@ -844,7 +830,7 @@ public: AstModport* modportp() const { return m_modportp; } void modportp(AstModport* modportp) { m_modportp = modportp; } bool isModport() { return !m_modportName.empty(); } - virtual bool isCompound() const override { return true; } // But not relevant + bool isCompound() const override { return true; } // But not relevant }; class AstMemberDType final : public AstNodeDType { // A member of a struct/union @@ -872,49 +858,45 @@ public: widthFromSub(subDTypep()); } ASTGEN_MEMBERS_MemberDType; - virtual string name() const override { return m_name; } // * = Var name - virtual bool hasDType() const override { return true; } - virtual bool maybePointedTo() const override { return true; } - virtual const char* broken() const override { + string name() const override { return m_name; } // * = Var name + bool hasDType() const override { return true; } + bool maybePointedTo() const override { return true; } + const char* broken() const override { BROKEN_RTN(m_refDTypep && !m_refDTypep->brokeExists()); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep(); } - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + AstNodeDType* getChildDTypep() const override { return childDTypep(); } // op1 = Range of variable AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } - virtual AstNodeDType* subDTypep() const override { - return m_refDTypep ? m_refDTypep : childDTypep(); - } + AstNodeDType* subDTypep() const override { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } - virtual AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } - virtual void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } - virtual bool similarDType(AstNodeDType* samep) const override { return this == samep; } + AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } + void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } + bool similarDType(AstNodeDType* samep) const override { return this == samep; } // // (Slow) recurse down to find basic data type (Note don't need virtual - // AstVar isn't a NodeDType) - virtual AstBasicDType* basicp() const override { return subDTypep()->basicp(); } + AstBasicDType* basicp() const override { return subDTypep()->basicp(); } // op1 = Range of variable (Note don't need virtual - AstVar isn't a NodeDType) AstNodeDType* dtypeSkipRefp() const { return subDTypep()->skipRefp(); } - virtual AstNodeDType* skipRefp() const override { return subDTypep()->skipRefp(); } - virtual AstNodeDType* skipRefToConstp() const override { - return subDTypep()->skipRefToConstp(); - } - virtual AstNodeDType* skipRefToEnump() const override { return subDTypep()->skipRefToEnump(); } + AstNodeDType* skipRefp() const override { return subDTypep()->skipRefp(); } + AstNodeDType* skipRefToConstp() const override { return subDTypep()->skipRefToConstp(); } + AstNodeDType* skipRefToEnump() const override { return subDTypep()->skipRefToEnump(); } // (Slow) recurses - Structure alignment 1,2,4 or 8 bytes (arrays affect this) - virtual int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } + int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } // (Slow) recurses - Width in bytes rounding up 1,2,4,8,12,... - virtual int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } + int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } // METHODS - virtual void name(const string& name) override { m_name = name; } - virtual void tag(const string& text) override { m_tag = text; } - virtual string tag() const override { return m_tag; } + void name(const string& name) override { m_name = name; } + void tag(const string& text) override { m_tag = text; } + string tag() const override { return m_tag; } int lsb() const { return m_lsb; } void lsb(int lsb) { m_lsb = lsb; } - virtual bool isCompound() const override { + bool isCompound() const override { v3fatalSrc("call isCompound on subdata type, not reference"); return false; } @@ -935,35 +917,31 @@ public: dtypep(nullptr); // V3Width will resolve } ASTGEN_MEMBERS_ParamTypeDType; - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + AstNodeDType* getChildDTypep() const override { return childDTypep(); } // op1 = Type assigning to AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } - virtual AstNodeDType* subDTypep() const override { - return dtypep() ? dtypep() : childDTypep(); - } - virtual AstBasicDType* basicp() const override { return subDTypep()->basicp(); } - virtual AstNodeDType* skipRefp() const override { return subDTypep()->skipRefp(); } - virtual AstNodeDType* skipRefToConstp() const override { - return subDTypep()->skipRefToConstp(); - } - virtual AstNodeDType* skipRefToEnump() const override { return subDTypep()->skipRefToEnump(); } - virtual bool similarDType(AstNodeDType* samep) const override { + AstNodeDType* subDTypep() const override { return dtypep() ? dtypep() : childDTypep(); } + AstBasicDType* basicp() const override { return subDTypep()->basicp(); } + AstNodeDType* skipRefp() const override { return subDTypep()->skipRefp(); } + AstNodeDType* skipRefToConstp() const override { return subDTypep()->skipRefToConstp(); } + AstNodeDType* skipRefToEnump() const override { return subDTypep()->skipRefToEnump(); } + bool similarDType(AstNodeDType* samep) const override { const AstParamTypeDType* const sp = static_cast(samep); return type() == samep->type() && sp && this->subDTypep()->skipRefp()->similarDType(sp->subDTypep()->skipRefp()); } - virtual int widthAlignBytes() const override { return dtypep()->widthAlignBytes(); } - virtual int widthTotalBytes() const override { return dtypep()->widthTotalBytes(); } + int widthAlignBytes() const override { return dtypep()->widthAlignBytes(); } + int widthTotalBytes() const override { return dtypep()->widthTotalBytes(); } // METHODS - virtual string name() const override { return m_name; } - virtual bool maybePointedTo() const override { return true; } - virtual bool hasDType() const override { return true; } - virtual void name(const string& flag) override { m_name = flag; } + string name() const override { return m_name; } + bool maybePointedTo() const override { return true; } + bool hasDType() const override { return true; } + void name(const string& flag) override { m_name = flag; } VVarType varType() const { return m_varType; } // * = Type of variable bool isParam() const { return true; } bool isGParam() const { return (varType() == VVarType::GPARAM); } - virtual bool isCompound() const override { + bool isCompound() const override { v3fatalSrc("call isCompound on subdata type, not reference"); return false; } @@ -978,16 +956,16 @@ public: ASTGEN_MEMBERS_ParseTypeDType; AstNodeDType* dtypep() const { return nullptr; } // METHODS - virtual bool similarDType(AstNodeDType* samep) const override { return this == samep; } - virtual AstBasicDType* basicp() const override { return nullptr; } - virtual AstNodeDType* skipRefp() const override { return nullptr; } + bool similarDType(AstNodeDType* samep) const override { return this == samep; } + AstBasicDType* basicp() const override { return nullptr; } + AstNodeDType* skipRefp() const override { return nullptr; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return 0; } - virtual int widthTotalBytes() const override { return 0; } - virtual bool isCompound() const override { + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return 0; } + int widthTotalBytes() const override { return 0; } + bool isCompound() const override { v3fatalSrc("call isCompound on subdata type, not reference"); return false; } @@ -1012,50 +990,48 @@ public: dtypep(dtp); } ASTGEN_MEMBERS_QueueDType; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep(); } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstQueueDType* const asamep = static_cast(samep); if (!asamep->subDTypep()) return false; return (subDTypep() == asamep->subDTypep()); } - virtual bool similarDType(AstNodeDType* samep) const override { + bool similarDType(AstNodeDType* samep) const override { const AstQueueDType* const asamep = static_cast(samep); return type() == samep->type() && asamep->subDTypep() && subDTypep()->skipRefp()->similarDType(asamep->subDTypep()->skipRefp()); } - virtual void dumpSmall(std::ostream& str) const override; - virtual string prettyDTypeName() const override; - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + void dumpSmall(std::ostream& str) const override; + string prettyDTypeName() const override; + AstNodeDType* getChildDTypep() const override { return childDTypep(); } // op1 = Range of variable AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } - virtual AstNodeDType* subDTypep() const override { - return m_refDTypep ? m_refDTypep : childDTypep(); - } + AstNodeDType* subDTypep() const override { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } AstNode* boundp() const { return op2p(); } // op2 = Bound, nullptr = none void boundp(AstNode* nodep) { setNOp2p(nodep); } inline int boundConst() const; - virtual AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } - virtual void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } + AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } + void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } // METHODS - virtual AstBasicDType* basicp() const override { return nullptr; } + AstBasicDType* basicp() const override { return nullptr; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } - virtual int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } - virtual bool isCompound() const override { return true; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } + int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } + bool isCompound() const override { return true; } }; class AstRefDType final : public AstNodeDType { private: @@ -1085,24 +1061,24 @@ public: // METHODS const char* broken() const override; void cloneRelink() override; - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstRefDType* const asamep = static_cast(samep); return (m_typedefp == asamep->m_typedefp && m_refDTypep == asamep->m_refDTypep && m_name == asamep->m_name && m_classOrPackagep == asamep->m_classOrPackagep); } - virtual bool similarDType(AstNodeDType* samep) const override { + bool similarDType(AstNodeDType* samep) const override { return skipRefp()->similarDType(samep->skipRefp()); } - virtual void dump(std::ostream& str = std::cout) const override; - virtual string name() const override { return m_name; } - virtual string prettyDTypeName() const override { + void dump(std::ostream& str = std::cout) const override; + string name() const override { return m_name; } + string prettyDTypeName() const override { return subDTypep() ? subDTypep()->name() : prettyName(); } - virtual AstBasicDType* basicp() const override { + AstBasicDType* basicp() const override { return subDTypep() ? subDTypep()->basicp() : nullptr; } AstNodeDType* subDTypep() const override; - virtual AstNodeDType* skipRefp() const override { + AstNodeDType* skipRefp() const override { // Skip past both the Ref and the Typedef if (subDTypep()) { return subDTypep()->skipRefp(); @@ -1111,7 +1087,7 @@ public: return nullptr; } } - virtual AstNodeDType* skipRefToConstp() const override { + AstNodeDType* skipRefToConstp() const override { if (subDTypep()) { return subDTypep()->skipRefToConstp(); } else { @@ -1119,7 +1095,7 @@ public: return nullptr; } } - virtual AstNodeDType* skipRefToEnump() const override { + AstNodeDType* skipRefToEnump() const override { if (subDTypep()) { return subDTypep()->skipRefToEnump(); } else { @@ -1127,23 +1103,23 @@ public: return nullptr; } } - virtual int widthAlignBytes() const override { return dtypeSkipRefp()->widthAlignBytes(); } - virtual int widthTotalBytes() const override { return dtypeSkipRefp()->widthTotalBytes(); } - virtual void name(const string& flag) override { m_name = flag; } + int widthAlignBytes() const override { return dtypeSkipRefp()->widthAlignBytes(); } + int widthTotalBytes() const override { return dtypeSkipRefp()->widthTotalBytes(); } + void name(const string& flag) override { m_name = flag; } // op1 = Range of variable AstNodeDType* dtypeSkipRefp() const { return subDTypep()->skipRefp(); } AstTypedef* typedefp() const { return m_typedefp; } void typedefp(AstTypedef* nodep) { m_typedefp = nodep; } AstNodeDType* refDTypep() const { return m_refDTypep; } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } - virtual AstNodeDType* virtRefDTypep() const override { return refDTypep(); } - virtual void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } + AstNodeDType* virtRefDTypep() const override { return refDTypep(); } + void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } AstNodeModule* classOrPackagep() const { return m_classOrPackagep; } void classOrPackagep(AstNodeModule* nodep) { m_classOrPackagep = nodep; } AstNode* typeofp() const { return op2p(); } AstNode* classOrPackageOpp() const { return op3p(); } AstPin* paramsp() const { return VN_AS(op4p(), Pin); } - virtual bool isCompound() const override { + bool isCompound() const override { v3fatalSrc("call isCompound on subdata type, not reference"); return false; } @@ -1161,35 +1137,33 @@ public: dtypep(nullptr); // V3Width will resolve } ASTGEN_MEMBERS_UnsizedArrayDType; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep(); } bool same(const AstNode* samep) const override; bool similarDType(AstNodeDType* samep) const override; - virtual void dumpSmall(std::ostream& str) const override; - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + void dumpSmall(std::ostream& str) const override; + AstNodeDType* getChildDTypep() const override { return childDTypep(); } // op1 = Range of variable AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } - virtual AstNodeDType* subDTypep() const override { - return m_refDTypep ? m_refDTypep : childDTypep(); - } + AstNodeDType* subDTypep() const override { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } - virtual AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } - virtual void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } + AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } + void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } // METHODS - virtual AstBasicDType* basicp() const override { return subDTypep()->basicp(); } - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } - virtual int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } - virtual bool isCompound() const override { return true; } + AstBasicDType* basicp() const override { return subDTypep()->basicp(); } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return subDTypep()->widthAlignBytes(); } + int widthTotalBytes() const override { return subDTypep()->widthTotalBytes(); } + bool isCompound() const override { return true; } }; class AstVoidDType final : public AstNodeDType { // For e.g. a function returning void @@ -1199,24 +1173,24 @@ public: dtypep(this); } ASTGEN_MEMBERS_VoidDType; - virtual void dumpSmall(std::ostream& str) const override; - virtual bool hasDType() const override { return true; } - virtual bool maybePointedTo() const override { return true; } - virtual bool undead() const override { return true; } - virtual AstNodeDType* subDTypep() const override { return nullptr; } - virtual AstNodeDType* virtRefDTypep() const override { return nullptr; } - virtual void virtRefDTypep(AstNodeDType* nodep) override {} - virtual bool similarDType(AstNodeDType* samep) const override { return this == samep; } - virtual AstBasicDType* basicp() const override { return nullptr; } + void dumpSmall(std::ostream& str) const override; + bool hasDType() const override { return true; } + bool maybePointedTo() const override { return true; } + bool undead() const override { return true; } + AstNodeDType* subDTypep() const override { return nullptr; } + AstNodeDType* virtRefDTypep() const override { return nullptr; } + void virtRefDTypep(AstNodeDType* nodep) override {} + bool similarDType(AstNodeDType* samep) const override { return this == samep; } + AstBasicDType* basicp() const override { return nullptr; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } // cppcheck-suppress csyleCast - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { return 1; } - virtual int widthTotalBytes() const override { return 1; } - virtual bool isCompound() const override { return false; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return 1; } + int widthTotalBytes() const override { return 1; } + bool isCompound() const override { return false; } }; class AstWildcardArrayDType final : public AstNodeDType { // Wildcard index type associative array data type, ie "some_dtype var_name [*]" @@ -1231,39 +1205,33 @@ public: dtypep(nullptr); // V3Width will resolve } ASTGEN_MEMBERS_WildcardArrayDType; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!((m_refDTypep && !childDTypep() && m_refDTypep->brokeExists()) || (!m_refDTypep && childDTypep()))); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_refDTypep && m_refDTypep->clonep()) m_refDTypep = m_refDTypep->clonep(); } bool same(const AstNode* samep) const override; bool similarDType(AstNodeDType* samep) const override; - virtual void dumpSmall(std::ostream& str) const override; - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + void dumpSmall(std::ostream& str) const override; + AstNodeDType* getChildDTypep() const override { return childDTypep(); } // op1 = Range of variable AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } - virtual AstNodeDType* subDTypep() const override { - return m_refDTypep ? m_refDTypep : childDTypep(); - } + AstNodeDType* subDTypep() const override { return m_refDTypep ? m_refDTypep : childDTypep(); } void refDTypep(AstNodeDType* nodep) { m_refDTypep = nodep; } - virtual AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } - virtual void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } + AstNodeDType* virtRefDTypep() const override { return m_refDTypep; } + void virtRefDTypep(AstNodeDType* nodep) override { refDTypep(nodep); } // METHODS - virtual AstBasicDType* basicp() const override { return subDTypep()->basicp(); } - virtual AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } - virtual AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } - virtual int widthAlignBytes() const override { - return sizeof(std::map); - } - virtual int widthTotalBytes() const override { - return sizeof(std::map); - } - virtual bool isCompound() const override { return true; } + AstBasicDType* basicp() const override { return subDTypep()->basicp(); } + AstNodeDType* skipRefp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToConstp() const override { return (AstNodeDType*)this; } + AstNodeDType* skipRefToEnump() const override { return (AstNodeDType*)this; } + int widthAlignBytes() const override { return sizeof(std::map); } + int widthTotalBytes() const override { return sizeof(std::map); } + bool isCompound() const override { return true; } }; // === AstNodeArrayDType === @@ -1275,8 +1243,8 @@ public: inline AstPackArrayDType(FileLine* fl, VFlagChildDType, AstNodeDType* dtp, AstRange* rangep); inline AstPackArrayDType(FileLine* fl, AstNodeDType* dtp, AstRange* rangep); ASTGEN_MEMBERS_PackArrayDType; - virtual string prettyDTypeName() const override; - virtual bool isCompound() const override { return false; } + string prettyDTypeName() const override; + bool isCompound() const override { return false; } }; class AstUnpackArrayDType final : public AstNodeArrayDType { // Array data type, ie "some_dtype var_name [2:0]" @@ -1304,15 +1272,15 @@ public: widthFromSub(subDTypep()); } ASTGEN_MEMBERS_UnpackArrayDType; - virtual string prettyDTypeName() const override; - virtual bool same(const AstNode* samep) const override { + string prettyDTypeName() const override; + bool same(const AstNode* samep) const override { const AstUnpackArrayDType* const sp = static_cast(samep); return m_isCompound == sp->m_isCompound; } // Outer dimension comes first. The first element is this node. std::vector unpackDimensions(); void isCompound(bool flag) { m_isCompound = flag; } - virtual bool isCompound() const override { return m_isCompound; } + bool isCompound() const override { return m_isCompound; } }; // === AstNodeUOrStructDType === @@ -1322,7 +1290,7 @@ public: AstStructDType(FileLine* fl, VSigning numericUnpack) : ASTGEN_SUPER_StructDType(fl, numericUnpack) {} ASTGEN_MEMBERS_StructDType; - virtual string verilogKwd() const override { return "struct"; } + string verilogKwd() const override { return "struct"; } }; class AstUnionDType final : public AstNodeUOrStructDType { public: @@ -1331,7 +1299,7 @@ public: AstUnionDType(FileLine* fl, VSigning numericUnpack) : ASTGEN_SUPER_UnionDType(fl, numericUnpack) {} ASTGEN_MEMBERS_UnionDType; - virtual string verilogKwd() const override { return "union"; } + string verilogKwd() const override { return "union"; } }; #endif // Guard diff --git a/src/V3AstNodeMath.h b/src/V3AstNodeMath.h index 78360c3c2..498fbce3b 100644 --- a/src/V3AstNodeMath.h +++ b/src/V3AstNodeMath.h @@ -46,8 +46,8 @@ protected: public: ASTGEN_MEMBERS_NodeMath; // METHODS - virtual void dump(std::ostream& str) const override; - virtual bool hasDType() const override { return true; } + void dump(std::ostream& str) const override; + bool hasDType() const override { return true; } virtual string emitVerilog() = 0; /// Format string for verilog writing; see V3EmitV // For documentation on emitC format see EmitCFunc::emitOpName virtual string emitC() = 0; @@ -87,8 +87,8 @@ public: // Signed flavor of nodes with both flavors? virtual bool signedFlavor() const { return false; } virtual bool stringFlavor() const { return false; } // N flavor of nodes with both flavors? - virtual int instrCount() const override { return widthInstrs(); } - virtual bool same(const AstNode*) const override { return true; } + int instrCount() const override { return widthInstrs(); } + bool same(const AstNode*) const override { return true; } }; class AstNodeBiCom VL_NOT_FINAL : public AstNodeBiop { // Binary math with commutative properties @@ -123,7 +123,7 @@ public: AstNode* bitp() const { return op2p(); } // op2 = Msb selection expression void bitp(AstNode* nodep) { setOp2p(nodep); } int bitConst() const; - virtual bool hasDType() const override { return true; } + bool hasDType() const override { return true; } }; class AstNodeStream VL_NOT_FINAL : public AstNodeBiop { // Verilog {rhs{lhs}} - Note rhsp() is the slice size, not the lhsp() @@ -143,13 +143,13 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_NodeSystemBiop; - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL_TRIG; } - virtual bool doubleFlavor() const override { return true; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL_TRIG; } + bool doubleFlavor() const override { return true; } }; class AstNodeQuadop VL_NOT_FINAL : public AstNodeMath { // Quaternary math @@ -185,8 +185,8 @@ 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 virtual bool sizeMattersFhs() const = 0; // True if output result depends on ths size - virtual int instrCount() const override { return widthInstrs(); } - virtual bool same(const AstNode*) const override { return true; } + int instrCount() const override { return widthInstrs(); } + bool same(const AstNode*) const override { return true; } }; class AstNodeTermop VL_NOT_FINAL : public AstNodeMath { // Terminal operator -- a operator with no "inputs" @@ -200,7 +200,7 @@ public: // See checkTreeIter also that asserts no children // cppcheck-suppress functionConst void iterateChildren(VNVisitor& v) {} - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; }; class AstNodeTriop VL_NOT_FINAL : public AstNodeMath { // Trinary math @@ -221,7 +221,7 @@ public: void rhsp(AstNode* nodep) { return setOp2p(nodep); } void thsp(AstNode* nodep) { return setOp3p(nodep); } // METHODS - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; // Set out to evaluation of a AstConst'ed virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, const V3Number& ths) @@ -232,8 +232,8 @@ public: virtual bool sizeMattersLhs() const = 0; // True if output result depends on lhs size 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 - virtual int instrCount() const override { return widthInstrs(); } - virtual bool same(const AstNode*) const override { return true; } + int instrCount() const override { return widthInstrs(); } + bool same(const AstNode*) const override { return true; } }; class AstNodeCond VL_NOT_FINAL : public AstNodeTriop { protected: @@ -248,21 +248,21 @@ protected: public: ASTGEN_MEMBERS_NodeCond; - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, - const V3Number& ths) override; + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, + const V3Number& ths) override; AstNode* condp() const { return op1p(); } // op1 = Condition AstNode* expr1p() const { return op2p(); } // op2 = If true... AstNode* expr2p() const { return op3p(); } // op3 = If false... - virtual string emitVerilog() override { return "%k(%l %f? %r %k: %t)"; } - virtual string emitC() override { return "VL_COND_%nq%lq%rq%tq(%nw, %P, %li, %ri, %ti)"; } - virtual bool cleanOut() const override { return false; } // clean if e1 & e2 clean - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return false; } - virtual bool cleanThs() const override { return false; } // Propagates up - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool sizeMattersThs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } + string emitVerilog() override { return "%k(%l %f? %r %k: %t)"; } + string emitC() override { return "VL_COND_%nq%lq%rq%tq(%nw, %P, %li, %ri, %ti)"; } + bool cleanOut() const override { return false; } // clean if e1 & e2 clean + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return false; } + bool cleanThs() const override { return false; } // Propagates up + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + bool sizeMattersThs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_BRANCH; } virtual AstNode* cloneType(AstNode* condp, AstNode* expr1p, AstNode* expr2p) = 0; }; class AstNodeUniop VL_NOT_FINAL : public AstNodeMath { @@ -279,7 +279,7 @@ public: AstNode* lhsp() const { return op1p(); } void lhsp(AstNode* nodep) { return setOp1p(nodep); } // METHODS - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; // Set out to evaluation of a AstConst'ed lhs virtual void numberOperate(V3Number& out, const V3Number& lhs) = 0; virtual bool cleanLhs() const = 0; @@ -288,8 +288,8 @@ public: // Signed flavor of nodes with both flavors? virtual bool signedFlavor() const { return false; } virtual bool stringFlavor() const { return false; } // N flavor of nodes with both flavors? - virtual int instrCount() const override { return widthInstrs(); } - virtual bool same(const AstNode*) const override { return true; } + int instrCount() const override { return widthInstrs(); } + bool same(const AstNode*) const override { return true; } }; class AstNodeSystemUniop VL_NOT_FINAL : public AstNodeUniop { public: @@ -298,11 +298,11 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_NodeSystemUniop; - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL_TRIG; } - virtual bool doubleFlavor() const override { return true; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL_TRIG; } + bool doubleFlavor() const override { return true; } }; class AstNodeVarRef VL_NOT_FINAL : public AstNodeMath { // An AstVarRef or AstVarXRef @@ -331,13 +331,13 @@ protected: public: ASTGEN_MEMBERS_NodeVarRef; - virtual void dump(std::ostream& str) const override; - virtual bool hasDType() const override { return true; } - virtual const char* broken() const override; - virtual int instrCount() const override { return widthInstrs(); } - virtual void cloneRelink() override; - virtual string name() const override { return m_name; } // * = Var name - virtual void name(const string& name) override { m_name = name; } + void dump(std::ostream& str) const override; + bool hasDType() const override { return true; } + const char* broken() const override; + int instrCount() const override { return widthInstrs(); } + void cloneRelink() override; + string name() const override { return m_name; } // * = Var name + void name(const string& name) override { m_name = name; } VAccess access() const { return m_access; } void access(const VAccess& flag) { m_access = flag; } // Avoid using this; Set in constructor AstVar* varp() const { return m_varp; } // [After Link] Pointer to variable @@ -372,11 +372,11 @@ public: public: ASTGEN_MEMBERS_AddrOfCFunc; - virtual void cloneRelink() override; - virtual const char* broken() const override; - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } + void cloneRelink() override; + const char* broken() const override; + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } AstCFunc* funcp() const { return m_funcp; } }; class AstCMath final : public AstNodeMath { @@ -394,12 +394,12 @@ public: } inline AstCMath(FileLine* fl, const string& textStmt, int setwidth, bool cleanOut = true); ASTGEN_MEMBERS_CMath; - virtual bool isGateOptimizable() const override { return m_pure; } - virtual bool isPredictOptimizable() const override { return m_pure; } - virtual bool cleanOut() const override { return m_cleanOut; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool isGateOptimizable() const override { return m_pure; } + bool isPredictOptimizable() const override { return m_pure; } + 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; } void addBodysp(AstNode* nodep) { addNOp1p(nodep); } AstNode* bodysp() const { return op1p(); } // op1 = expressions to print bool pure() const { return m_pure; } @@ -415,13 +415,13 @@ public: setNOp1p(defaultp); } ASTGEN_MEMBERS_ConsAssoc; - virtual string emitVerilog() override { return "'{}"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "'{}"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } + int instrCount() const override { return widthInstrs(); } AstNode* defaultp() const { return op1p(); } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstConsDynArray final : public AstNodeMath { // Construct a queue and return object, '{}. '{lhs}, '{lhs. rhs} @@ -434,14 +434,14 @@ public: setNOp2p(rhsp); } ASTGEN_MEMBERS_ConsDynArray; - virtual string emitVerilog() override { return "'{%l, %r}"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "'{%l, %r}"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } + int instrCount() const override { return widthInstrs(); } AstNode* lhsp() const { return op1p(); } // op1 = expression AstNode* rhsp() const { return op2p(); } // op2 = expression - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstConsQueue final : public AstNodeMath { // Construct a queue and return object, '{}. '{lhs}, '{lhs. rhs} @@ -454,14 +454,14 @@ public: setNOp2p(rhsp); } ASTGEN_MEMBERS_ConsQueue; - virtual string emitVerilog() override { return "'{%l, %r}"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "'{%l, %r}"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } + int instrCount() const override { return widthInstrs(); } AstNode* lhsp() const { return op1p(); } // op1 = expression AstNode* rhsp() const { return op2p(); } // op2 = expression - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstConsWildcard final : public AstNodeMath { // Construct a wildcard assoc array and return object, '{} @@ -473,13 +473,13 @@ public: setNOp1p(defaultp); } ASTGEN_MEMBERS_ConsWildcard; - virtual string emitVerilog() override { return "'{}"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "'{}"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } + int instrCount() const override { return widthInstrs(); } AstNode* defaultp() const { return op1p(); } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstConst final : public AstNodeMath { // A constant @@ -595,20 +595,20 @@ public: initWithNumber(); } ASTGEN_MEMBERS_Const; - virtual string name() const override { return num().ascii(); } // * = Value + string name() const override { return num().ascii(); } // * = Value const V3Number& num() const { return m_num; } // * = Value V3Number& num() { return m_num; } // * = Value uint32_t toUInt() const { return num().toUInt(); } int32_t toSInt() const { return num().toSInt(); } uint64_t toUQuad() const { return num().toUQuad(); } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual bool same(const AstNode* samep) const override { + 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 { const AstConst* const sp = static_cast(samep); return num().isCaseEq(sp->num()); } - virtual int instrCount() const override { return widthInstrs(); } + int instrCount() const override { return widthInstrs(); } bool isEqAllOnes() const { return num().isEqAllOnes(width()); } bool isEqAllOnesV() const { return num().isEqAllOnes(widthMinV()); } // Parse string and create appropriate type of AstConst. @@ -620,10 +620,10 @@ public: explicit AstEmptyQueue(FileLine* fl) : ASTGEN_SUPER_EmptyQueue(fl) {} ASTGEN_MEMBERS_EmptyQueue; - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitVerilog() override { return "{}"; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual bool cleanOut() const override { return true; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitVerilog() override { return "{}"; } + bool same(const AstNode* /*samep*/) const override { return true; } + bool cleanOut() const override { return true; } }; class AstEnumItemRef final : public AstNodeMath { private: @@ -637,21 +637,21 @@ public: dtypeFrom(m_itemp); } ASTGEN_MEMBERS_EnumItemRef; - virtual void dump(std::ostream& str) const override; - virtual string name() const override { return itemp()->name(); } - virtual int instrCount() const override { return 0; } + void dump(std::ostream& str) const override; + string name() const override { return itemp()->name(); } + int instrCount() const override { return 0; } const char* broken() const override; - virtual void cloneRelink() override { + void cloneRelink() override { if (m_itemp->clonep()) m_itemp = m_itemp->clonep(); } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstEnumItemRef* const sp = static_cast(samep); return itemp() == sp->itemp(); } AstEnumItem* itemp() const { return m_itemp; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } AstNodeModule* classOrPackagep() const { return m_classOrPackagep; } void classOrPackagep(AstNodeModule* nodep) { m_classOrPackagep = nodep; } }; @@ -672,10 +672,10 @@ public: void addStmtsp(AstNode* nodep) { addOp1p(nodep); } AstNode* resultp() const { return op2p(); } // METHODS - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool same(const AstNode*) const override { return true; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool same(const AstNode*) const override { return true; } }; class AstFError final : public AstNodeMath { public: @@ -685,20 +685,18 @@ public: setOp2p(strp); } ASTGEN_MEMBERS_FError; - virtual string emitVerilog() override { return "%f$ferror(%l, %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } + string emitVerilog() override { return "%f$ferror(%l, %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } virtual bool cleanLhs() const { return true; } virtual bool sizeMattersLhs() const { return false; } - virtual int instrCount() const override { return widthInstrs() * 64; } - virtual bool isPure() const override { - return false; - } // SPECIAL: $display has 'visual' ordering + int instrCount() const override { return widthInstrs() * 64; } + bool isPure() const override { return false; } // SPECIAL: $display has 'visual' ordering void filep(AstNode* nodep) { setOp1p(nodep); } AstNode* filep() const { return op1p(); } void strp(AstNode* nodep) { setOp2p(nodep); } AstNode* strp() const { return op2p(); } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstFRead final : public AstNodeMath { // Parents: expr @@ -715,15 +713,15 @@ public: setNOp4p(countp); } ASTGEN_MEMBERS_FRead; - virtual string verilogKwd() const override { return "$fread"; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering - virtual bool isOutputter() const override { return true; } // SPECIAL: makes output - virtual bool cleanOut() const override { return false; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$fread"; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering + bool isOutputter() const override { return true; } // SPECIAL: makes output + bool cleanOut() const override { return false; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* memp() const { return op1p(); } void memp(AstNode* nodep) { setOp1p(nodep); } AstNode* filep() const { return op2p(); } @@ -742,16 +740,16 @@ public: setNOp2p(filep); } ASTGEN_MEMBERS_FRewind; - virtual string verilogKwd() const override { return "$frewind"; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual bool isUnlikely() const override { return true; } - virtual bool cleanOut() const override { return false; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$frewind"; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + bool isUnlikely() const override { return true; } + bool cleanOut() const override { return false; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* filep() const { return op2p(); } void filep(AstNodeVarRef* nodep) { setNOp2p((AstNode*)nodep); } }; @@ -770,16 +768,16 @@ public: setNOp2p(filep); } ASTGEN_MEMBERS_FScanF; - virtual string name() const override { return m_text; } - virtual string verilogKwd() const override { return "$fscanf"; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering - virtual bool isOutputter() const override { return true; } // SPECIAL: makes output - virtual bool cleanOut() const override { return false; } - virtual bool same(const AstNode* samep) const override { + string name() const override { return m_text; } + string verilogKwd() const override { return "$fscanf"; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering + bool isOutputter() const override { return true; } // SPECIAL: makes output + bool cleanOut() const override { return false; } + bool same(const AstNode* samep) const override { return text() == static_cast(samep)->text(); } AstNode* exprsp() const { return op1p(); } // op1 = Expressions to output @@ -802,15 +800,15 @@ public: setNOp4p(operation); } ASTGEN_MEMBERS_FSeek; - virtual string verilogKwd() const override { return "$fseek"; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering - virtual bool isOutputter() const override { return true; } // SPECIAL: makes output - virtual bool cleanOut() const override { return false; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$fseek"; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering + bool isOutputter() const override { return true; } // SPECIAL: makes output + bool cleanOut() const override { return false; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* filep() const { return op2p(); } void filep(AstNode* nodep) { setOp2p(nodep); } AstNode* offset() const { return op3p(); } @@ -827,16 +825,16 @@ public: setNOp2p(filep); } ASTGEN_MEMBERS_FTell; - virtual string verilogKwd() const override { return "$ftell"; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual bool isUnlikely() const override { return true; } - virtual bool cleanOut() const override { return false; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$ftell"; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + bool isUnlikely() const override { return true; } + bool cleanOut() const override { return false; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* filep() const { return op2p(); } void filep(AstNodeVarRef* nodep) { setNOp2p((AstNode*)nodep); } }; @@ -850,15 +848,15 @@ public: addOp1p(exprp); } ASTGEN_MEMBERS_Fell; - virtual string emitVerilog() override { return "$fell(%l)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "$fell(%l)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { V3ERROR_NA_RETURN(""); } + int instrCount() const override { return widthInstrs(); } AstNode* exprp() const { return op1p(); } // op1 = expression AstSenTree* sentreep() const { return VN_AS(op2p(), SenTree); } // op2 = clock domain void sentreep(AstSenTree* sentreep) { addOp2p((AstNode*)sentreep); } // op2 = clock domain - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstGatePin final : public AstNodeMath { // Possibly expand a gate primitive input pin value to match the range of the gate primitive @@ -869,9 +867,9 @@ public: setOp2p((AstNode*)rangep); } ASTGEN_MEMBERS_GatePin; - virtual string emitVerilog() override { return "%l"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } + string emitVerilog() override { return "%l"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } AstNode* exprp() const { return op1p(); } // op1 = Pin expression AstRange* rangep() const { return VN_AS(op2p(), Range); } // op2 = Range of pin }; @@ -886,18 +884,18 @@ public: setOp2p(rhs); } ASTGEN_MEMBERS_Implication; - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { V3ERROR_NA_RETURN(""); } + int instrCount() const override { return widthInstrs(); } AstNode* lhsp() const { return op1p(); } AstNode* rhsp() const { return op2p(); } void lhsp(AstNode* nodep) { return setOp1p(nodep); } void rhsp(AstNode* nodep) { return setOp2p(nodep); } AstSenTree* sentreep() const { return VN_AS(op4p(), SenTree); } // op4 = clock domain void sentreep(AstSenTree* sentreep) { addOp4p((AstNode*)sentreep); } // op4 = clock domain - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstInside final : public AstNodeMath { public: @@ -911,9 +909,9 @@ public: AstNode* exprp() const { return op1p(); } // op1 = LHS expression to compare with // op2 = RHS, possibly a list of expr or AstInsideRange AstNode* itemsp() const { return op2p(); } - virtual string emitVerilog() override { return "%l inside { %r }"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } // NA + string emitVerilog() override { return "%l inside { %r }"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } // NA }; class AstInsideRange final : public AstNodeMath { public: @@ -925,9 +923,9 @@ public: ASTGEN_MEMBERS_InsideRange; AstNode* lhsp() const { return op1p(); } // op1 = LHS AstNode* rhsp() const { return op2p(); } // op2 = RHS - virtual string emitVerilog() override { return "[%l:%r]"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } // NA + string emitVerilog() override { return "[%l:%r]"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } // NA // Create AstAnd(AstGte(...), AstLte(...)) AstNode* newAndFromInside(AstNode* exprp, AstNode* lhsp, AstNode* rhsp); }; @@ -945,14 +943,14 @@ public: , m_name{name} , m_index(index) {} ASTGEN_MEMBERS_LambdaArgRef; - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual string emitVerilog() override { return name(); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual bool hasDType() const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } - virtual string name() const override { return m_name; } // * = Var name - virtual void name(const string& name) override { m_name = name; } + bool same(const AstNode* /*samep*/) const override { return true; } + string emitVerilog() override { return name(); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } + bool hasDType() const override { return true; } + int instrCount() const override { return widthInstrs(); } + string name() const override { return m_name; } // * = Var name + void name(const string& name) override { m_name = name; } bool index() const { return m_index; } }; class AstMemberSel final : public AstNodeMath { @@ -978,15 +976,13 @@ public: ASTGEN_MEMBERS_MemberSel; void cloneRelink() override; const char* broken() const override; - virtual void dump(std::ostream& str) const override; - virtual string name() const override { return m_name; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool same(const AstNode* samep) const override { - return true; - } // dtype comparison does it - virtual int instrCount() const override { return widthInstrs(); } + void dump(std::ostream& str) const override; + string name() const override { return m_name; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool same(const AstNode* samep) const override { return true; } // dtype comparison does it + int instrCount() const override { return widthInstrs(); } AstNode* fromp() const { return op1p(); } // op1 = Extracting what (nullptr=TBD during parsing) @@ -1005,11 +1001,11 @@ public: setNOp1p(rhsp); } ASTGEN_MEMBERS_NewCopy; - virtual string emitVerilog() override { return "new"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + 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; } + int instrCount() const override { return widthInstrs(); } AstNode* rhsp() const { return op1p(); } }; class AstNewDynamic final : public AstNodeMath { @@ -1024,11 +1020,11 @@ public: setNOp2p(rhsp); } ASTGEN_MEMBERS_NewDynamic; - virtual string emitVerilog() override { return "new"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + 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; } + int instrCount() const override { return widthInstrs(); } AstNode* sizep() const { return op1p(); } AstNode* rhsp() const { return op2p(); } }; @@ -1043,16 +1039,16 @@ public: addNOp2p(ticksp); } ASTGEN_MEMBERS_Past; - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { V3ERROR_NA_RETURN(""); } + int instrCount() const override { return widthInstrs(); } AstNode* exprp() const { return op1p(); } // op1 = expression AstNode* ticksp() const { return op2p(); } // op2 = ticks or nullptr means 1 AstSenTree* sentreep() const { return VN_AS(op4p(), SenTree); } // op4 = clock domain void sentreep(AstSenTree* sentreep) { addOp4p((AstNode*)sentreep); } // op4 = clock domain - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstPatMember final : public AstNodeMath { // Verilog '{a} or '{a{b}} @@ -1067,12 +1063,12 @@ public: addOp1p(lhsp), setNOp2p(keyp), setNOp3p(repp); } ASTGEN_MEMBERS_PatMember; - virtual string emitVerilog() override { return lhssp() ? "%f{%r{%k%l}}" : "%l"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); } - virtual int instrCount() const override { return widthInstrs() * 2; } - virtual void dump(std::ostream& str = std::cout) const override; + string emitVerilog() override { return lhssp() ? "%f{%r{%k%l}}" : "%l"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { V3ERROR_NA_RETURN(""); } + int instrCount() const override { return widthInstrs() * 2; } + void dump(std::ostream& str = std::cout) const override; // op1 = expression to assign or another AstPattern (list if replicated) AstNode* lhssp() const { return op1p(); } AstNode* keyp() const { return op2p(); } // op2 = assignment key (Const, id Text) @@ -1090,12 +1086,12 @@ public: addNOp2p(itemsp); } ASTGEN_MEMBERS_Pattern; - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); } - virtual int instrCount() const override { return widthInstrs(); } - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { V3ERROR_NA_RETURN(""); } + int instrCount() const override { return widthInstrs(); } + AstNodeDType* getChildDTypep() const override { return childDTypep(); } virtual AstNodeDType* subDTypep() const { return dtypep() ? dtypep() : childDTypep(); } // op1 = Type assigning to AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } @@ -1122,22 +1118,22 @@ public: setNOp1p(seedp); } ASTGEN_MEMBERS_Rand; - virtual string emitVerilog() override { + string emitVerilog() override { return seedp() ? (m_urandom ? "%f$urandom(%l)" : "%f$random(%l)") : (m_urandom ? "%f$urandom()" : "%f$random()"); } - virtual string emitC() override { + string emitC() override { return m_reset ? "VL_RAND_RESET_%nq(%nw, %P)" : seedp() ? (urandom() ? "VL_URANDOM_SEEDED_%nq%lq(%li)" : "VL_RANDOM_SEEDED_%nq%lq(%li)") : isWide() ? "VL_RANDOM_%nq(%nw, %P)" // : "VL_RANDOM_%nq()"; } - virtual bool cleanOut() const override { return false; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_PLI; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool cleanOut() const override { return false; } + 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 combinable(const AstRand* samep) const { return !seedp() && !samep->seedp() && reset() == samep->reset() && urandom() == samep->urandom(); @@ -1156,15 +1152,15 @@ public: addOp1p(exprp); } ASTGEN_MEMBERS_Rose; - virtual string emitVerilog() override { return "$rose(%l)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "$rose(%l)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { V3ERROR_NA_RETURN(""); } + int instrCount() const override { return widthInstrs(); } AstNode* exprp() const { return op1p(); } // op1 = expression AstSenTree* sentreep() const { return VN_AS(op2p(), SenTree); } // op2 = clock domain void sentreep(AstSenTree* sentreep) { addOp2p((AstNode*)sentreep); } // op2 = clock domain - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstSScanF final : public AstNodeMath { // Parents: expr @@ -1181,16 +1177,16 @@ public: setOp2p(fromp); } ASTGEN_MEMBERS_SScanF; - virtual string name() const override { return m_text; } - virtual string verilogKwd() const override { return "$sscanf"; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering - virtual bool isOutputter() const override { return true; } // SPECIAL: makes output - virtual bool cleanOut() const override { return false; } - virtual bool same(const AstNode* samep) const override { + string name() const override { return m_text; } + string verilogKwd() const override { return "$sscanf"; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } // SPECIAL: has 'visual' ordering + bool isOutputter() const override { return true; } // SPECIAL: makes output + bool cleanOut() const override { return false; } + bool same(const AstNode* samep) const override { return text() == static_cast(samep)->text(); } AstNode* exprsp() const { return op1p(); } // op1 = Expressions to output @@ -1210,13 +1206,13 @@ public: addOp1p(exprp); } ASTGEN_MEMBERS_Sampled; - virtual string emitVerilog() override { return "$sampled(%l)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); } - virtual int instrCount() const override { return 0; } + string emitVerilog() override { return "$sampled(%l)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { V3ERROR_NA_RETURN(""); } + int instrCount() const override { return 0; } AstNode* exprp() const { return op1p(); } // op1 = expression - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstScopeName final : public AstNodeMath { // For display %m and DPI context imports @@ -1236,14 +1232,14 @@ public: dtypeSetUInt64(); } ASTGEN_MEMBERS_ScopeName; - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { return (m_dpiExport == static_cast(samep)->m_dpiExport && m_forFormat == static_cast(samep)->m_forFormat); } - virtual string emitVerilog() override { return ""; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual void dump(std::ostream& str = std::cout) const override; + string emitVerilog() override { return ""; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } + void dump(std::ostream& str = std::cout) const override; AstText* scopeAttrp() const { return VN_AS(op1p(), Text); } void scopeAttrp(AstNode* nodep) { addOp1p(nodep); } AstText* scopeEntrp() const { return VN_AS(op2p(), Text); } @@ -1276,15 +1272,15 @@ public: setOp3p(valuep); } ASTGEN_MEMBERS_SetAssoc; - virtual string emitVerilog() override { return "'{}"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "'{}"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } + int instrCount() const override { return widthInstrs(); } AstNode* lhsp() const { return op1p(); } AstNode* keyp() const { return op2p(); } AstNode* valuep() const { return op3p(); } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstSetWildcard final : public AstNodeMath { // Set a wildcard assoc array element and return object, '{} @@ -1298,15 +1294,15 @@ public: setOp3p(valuep); } ASTGEN_MEMBERS_SetWildcard; - virtual string emitVerilog() override { return "'{}"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "'{}"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } + int instrCount() const override { return widthInstrs(); } AstNode* lhsp() const { return op1p(); } AstNode* keyp() const { return op2p(); } AstNode* valuep() const { return op3p(); } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstStable final : public AstNodeMath { // Verilog $stable @@ -1318,15 +1314,15 @@ public: addOp1p(exprp); } ASTGEN_MEMBERS_Stable; - virtual string emitVerilog() override { return "$stable(%l)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "$stable(%l)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { V3ERROR_NA_RETURN(""); } + int instrCount() const override { return widthInstrs(); } AstNode* exprp() const { return op1p(); } // op1 = expression AstSenTree* sentreep() const { return VN_AS(op2p(), SenTree); } // op2 = clock domain void sentreep(AstSenTree* sentreep) { addOp2p((AstNode*)sentreep); } // op2 = clock domain - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstSystemF final : public AstNodeMath { // $system used as function @@ -1336,16 +1332,16 @@ public: setOp1p(lhsp); } ASTGEN_MEMBERS_SystemF; - virtual string verilogKwd() const override { return "$system"; } - virtual string emitVerilog() override { return verilogKwd(); } - virtual string emitC() override { return "VL_SYSTEM_%nq(%lw, %P)"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual bool isUnlikely() const override { return true; } - virtual bool cleanOut() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$system"; } + string emitVerilog() override { return verilogKwd(); } + string emitC() override { return "VL_SYSTEM_%nq(%lw, %P)"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + bool isUnlikely() const override { return true; } + bool cleanOut() const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* lhsp() const { return op1p(); } }; class AstTestPlusArgs final : public AstNodeMath { @@ -1357,13 +1353,13 @@ public: setOp1p(searchp); } ASTGEN_MEMBERS_TestPlusArgs; - virtual string verilogKwd() const override { return "$test$plusargs"; } - virtual string emitVerilog() override { return verilogKwd(); } - virtual string emitC() override { return "VL_VALUEPLUSARGS_%nq(%lw, %P, nullptr)"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool cleanOut() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$test$plusargs"; } + string emitVerilog() override { return verilogKwd(); } + string emitC() override { return "VL_VALUEPLUSARGS_%nq(%lw, %P, nullptr)"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool cleanOut() const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* searchp() const { return op1p(); } // op1 = Search expression void searchp(AstNode* nodep) { setOp1p(nodep); } }; @@ -1376,17 +1372,17 @@ public: addNOp1p(exprsp); } ASTGEN_MEMBERS_UCFunc; - virtual bool cleanOut() const override { return false; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } AstNode* bodysp() const { return op1p(); } // op1 = expressions to print - virtual bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs - virtual bool isOutputter() const override { return true; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isSubstOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_PLI; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs + bool isOutputter() const override { return true; } + bool isGateOptimizable() const override { return false; } + 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; } }; class AstUnbounded final : public AstNodeMath { // A $ in the parser, used for unbounded and queues @@ -1397,9 +1393,9 @@ public: dtypeSetSigned32(); } ASTGEN_MEMBERS_Unbounded; - virtual string emitVerilog() override { return "$"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } + string emitVerilog() override { return "$"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } }; class AstValuePlusArgs final : public AstNodeMath { // Parents: expr @@ -1411,14 +1407,14 @@ public: setOp2p(outp); } ASTGEN_MEMBERS_ValuePlusArgs; - virtual string verilogKwd() const override { return "$value$plusargs"; } - virtual string emitVerilog() override { return "%f$value$plusargs(%l, %k%r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return !outp(); } - virtual bool cleanOut() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$value$plusargs"; } + string emitVerilog() override { return "%f$value$plusargs(%l, %k%r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return !outp(); } + bool cleanOut() const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* searchp() const { return op1p(); } // op1 = Search expression void searchp(AstNode* nodep) { setOp1p(nodep); } AstNode* outp() const { return op2p(); } // op2 = Expressions to output @@ -1436,20 +1432,20 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_BufIf1; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstBufIf1(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opBufIf1(lhs, rhs); } - virtual string emitVerilog() override { return "bufif(%r,%l)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } // Lclean || Rclean - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } // Lclean || Rclean - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(""); } // Lclean || Rclean - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "bufif(%r,%l)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } // Lclean || Rclean + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } // Lclean || Rclean + bool cleanOut() const override { V3ERROR_NA_RETURN(""); } // Lclean || Rclean + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstCastDynamic final : public AstNodeBiop { // Verilog $cast used as a function @@ -1463,21 +1459,21 @@ public: AstCastDynamic(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : ASTGEN_SUPER_CastDynamic(fl, lhsp, rhsp) {} ASTGEN_MEMBERS_CastDynamic; - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { V3ERROR_NA; } - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstCastDynamic(this->fileline(), lhsp, rhsp); } - virtual string emitVerilog() override { return "%f$cast(%r, %l)"; } - virtual string emitC() override { return "VL_DYNAMIC_CAST(%r, %l)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 20; } - virtual bool isPure() const override { return true; } + string emitVerilog() override { return "%f$cast(%r, %l)"; } + string emitC() override { return "VL_DYNAMIC_CAST(%r, %l)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 20; } + bool isPure() const override { return true; } AstNode* fromp() const { return lhsp(); } AstNode* top() const { return rhsp(); } }; @@ -1492,25 +1488,25 @@ public: dtypeSetUInt32(); } ASTGEN_MEMBERS_CompareNN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstCompareNN(this->fileline(), lhsp, rhsp, m_ignoreCase); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opCompareNN(lhs, rhs, m_ignoreCase); } - virtual string name() const override { return m_ignoreCase ? "icompare" : "compare"; } - virtual string emitVerilog() override { + string name() const override { return m_ignoreCase ? "icompare" : "compare"; } + string emitVerilog() override { return m_ignoreCase ? "%k(%l.icompare(%r))" : "%k(%l.compare(%r))"; } - virtual string emitC() override { + string emitC() override { return m_ignoreCase ? "VL_CMP_NN(%li,%ri,true)" : "VL_CMP_NN(%li,%ri,false)"; } - virtual string emitSimpleOperator() override { return ""; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitSimpleOperator() override { return ""; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstConcat final : public AstNodeBiop { // If you're looking for {#{}}, see AstReplicate @@ -1523,20 +1519,20 @@ public: } } ASTGEN_MEMBERS_Concat; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstConcat(this->fileline(), lhsp, rhsp); } - virtual string emitVerilog() override { return "%f{%l, %k%r}"; } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + string emitVerilog() override { return "%f{%l, %k%r}"; } + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opConcat(lhs, rhs); } - virtual string emitC() override { return "VL_CONCAT_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 2; } + string emitC() override { return "VL_CONCAT_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 2; } }; class AstConcatN final : public AstNodeBiop { // String concatenate @@ -1546,21 +1542,21 @@ public: dtypeSetString(); } ASTGEN_MEMBERS_ConcatN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstConcatN(this->fileline(), lhsp, rhsp); } - virtual string emitVerilog() override { return "%f{%l, %k%r}"; } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + string emitVerilog() override { return "%f{%l, %k%r}"; } + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opConcatN(lhs, rhs); } - virtual string emitC() override { return "VL_CONCATN_NNN(%li, %ri)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_STR; } - virtual bool stringFlavor() const override { return true; } + string emitC() override { return "VL_CONCATN_NNN(%li, %ri)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_STR; } + bool stringFlavor() const override { return true; } }; class AstDiv final : public AstNodeBiop { public: @@ -1569,20 +1565,20 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_Div; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstDiv(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opDiv(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f/ %r)"; } - virtual string emitC() override { return "VL_DIV_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_DIV; } + string emitVerilog() override { return "%k(%l %f/ %r)"; } + string emitC() override { return "VL_DIV_%nq%lq%rq(%lw, %P, %li, %ri)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_DIV; } }; class AstDivD final : public AstNodeBiop { public: @@ -1591,22 +1587,22 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_DivD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstDivD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opDivD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f/ %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "/"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL_DIV; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f/ %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "/"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL_DIV; } + bool doubleFlavor() const override { return true; } }; class AstDivS final : public AstNodeBiop { public: @@ -1615,21 +1611,21 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_DivS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstDivS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opDivS(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f/ %r)"; } - virtual string emitC() override { return "VL_DIVS_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_DIV; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f/ %r)"; } + string emitC() override { return "VL_DIVS_%nq%lq%rq(%lw, %P, %li, %ri)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_DIV; } + bool signedFlavor() const override { return true; } }; class AstEqWild final : public AstNodeBiop { // Note wildcard operator rhs differs from lhs @@ -1639,45 +1635,45 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_EqWild; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstEqWild(this->fileline(), lhsp, rhsp); } static AstNodeBiop* newTyped(FileLine* fl, AstNode* lhsp, AstNode* rhsp); // Return AstEqWild/AstEqD - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opWildEq(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f==? %r)"; } - virtual string emitC() override { return "VL_EQ_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "=="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f==? %r)"; } + string emitC() override { return "VL_EQ_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "=="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstFGetS final : public AstNodeBiop { public: AstFGetS(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : ASTGEN_SUPER_FGetS(fl, lhsp, rhsp) {} ASTGEN_MEMBERS_FGetS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstFGetS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { V3ERROR_NA; } - virtual string emitVerilog() override { return "%f$fgets(%l,%r)"; } - virtual string emitC() override { + string emitVerilog() override { return "%f$fgets(%l,%r)"; } + string emitC() override { return strgp()->dtypep()->basicp()->isString() ? "VL_FGETS_NI(%li, %ri)" : "VL_FGETS_%nqX%rq(%lw, %P, &(%li), %ri)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 64; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 64; } AstNode* strgp() const { return lhsp(); } AstNode* filep() const { return rhsp(); } }; @@ -1686,26 +1682,24 @@ public: AstFUngetC(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : ASTGEN_SUPER_FUngetC(fl, lhsp, rhsp) {} ASTGEN_MEMBERS_FUngetC; - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { V3ERROR_NA; } - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstFUngetC(this->fileline(), lhsp, rhsp); } - virtual string emitVerilog() override { return "%f$ungetc(%r, %l)"; } + string emitVerilog() override { return "%f$ungetc(%r, %l)"; } // Non-existent filehandle returns EOF - virtual string emitC() override { + string emitC() override { return "(%li ? (ungetc(%ri, VL_CVT_I_FP(%li)) >= 0 ? 0 : -1) : -1)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 64; } - virtual bool isPure() const override { - return false; - } // SPECIAL: $display has 'visual' ordering + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 64; } + bool isPure() const override { return false; } // SPECIAL: $display has 'visual' ordering AstNode* filep() const { return lhsp(); } AstNode* charp() const { return rhsp(); } }; @@ -1717,21 +1711,21 @@ public: dtypeSetBitSized(8, VSigning::UNSIGNED); } ASTGEN_MEMBERS_GetcN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstGetcN(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opGetcN(lhs, rhs); } - virtual string name() const override { return "getc"; } - virtual string emitVerilog() override { return "%k(%l.getc(%r))"; } - virtual string emitC() override { return "VL_GETC_N(%li,%ri)"; } - virtual string emitSimpleOperator() override { return ""; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string name() const override { return "getc"; } + string emitVerilog() override { return "%k(%l.getc(%r))"; } + string emitC() override { return "VL_GETC_N(%li,%ri)"; } + string emitSimpleOperator() override { return ""; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstGetcRefN final : public AstNodeBiop { // Verilog string[#] on the left-hand-side of assignment @@ -1742,20 +1736,20 @@ public: dtypeSetBitSized(8, VSigning::UNSIGNED); } ASTGEN_MEMBERS_GetcRefN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstGetcRefN(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { V3ERROR_NA; } - virtual string emitVerilog() override { return "%k%l[%r]"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return ""; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k%l[%r]"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return ""; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstGt final : public AstNodeBiop { public: @@ -1764,20 +1758,20 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_Gt; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstGt(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opGt(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f> %r)"; } - virtual string emitC() override { return "VL_GT_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return ">"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f> %r)"; } + string emitC() override { return "VL_GT_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return ">"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstGtD final : public AstNodeBiop { public: @@ -1786,22 +1780,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_GtD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstGtD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opGtD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f> %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return ">"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f> %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return ">"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } + bool doubleFlavor() const override { return true; } }; class AstGtN final : public AstNodeBiop { public: @@ -1810,22 +1804,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_GtN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstGtN(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opGtN(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f> %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return ">"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_STR; } - virtual bool stringFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f> %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return ">"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_STR; } + bool stringFlavor() const override { return true; } }; class AstGtS final : public AstNodeBiop { public: @@ -1834,21 +1828,21 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_GtS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstGtS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opGtS(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f> %r)"; } - virtual string emitC() override { return "VL_GTS_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return ""; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f> %r)"; } + string emitC() override { return "VL_GTS_%nq%lq%rq(%lw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return ""; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + bool signedFlavor() const override { return true; } }; class AstGte final : public AstNodeBiop { public: @@ -1857,20 +1851,20 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_Gte; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstGte(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opGte(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f>= %r)"; } - virtual string emitC() override { return "VL_GTE_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return ">="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f>= %r)"; } + string emitC() override { return "VL_GTE_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return ">="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstGteD final : public AstNodeBiop { public: @@ -1879,22 +1873,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_GteD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstGteD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opGteD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f>= %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return ">="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f>= %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return ">="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } + bool doubleFlavor() const override { return true; } }; class AstGteN final : public AstNodeBiop { public: @@ -1903,22 +1897,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_GteN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstGteN(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opGteN(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f>= %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return ">="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_STR; } - virtual bool stringFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f>= %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return ">="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_STR; } + bool stringFlavor() const override { return true; } }; class AstGteS final : public AstNodeBiop { public: @@ -1927,21 +1921,21 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_GteS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstGteS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opGteS(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f>= %r)"; } - virtual string emitC() override { return "VL_GTES_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return ""; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f>= %r)"; } + string emitC() override { return "VL_GTES_%nq%lq%rq(%lw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return ""; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + bool signedFlavor() const override { return true; } }; class AstLogAnd final : public AstNodeBiop { public: @@ -1950,21 +1944,21 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LogAnd; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLogAnd(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLogAnd(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f&& %r)"; } - virtual string emitC() override { return "VL_LOGAND_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "&&"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() + INSTR_COUNT_BRANCH; } + string emitVerilog() override { return "%k(%l %f&& %r)"; } + string emitC() override { return "VL_LOGAND_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "&&"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() + INSTR_COUNT_BRANCH; } }; class AstLogIf final : public AstNodeBiop { public: @@ -1973,21 +1967,21 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LogIf; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLogIf(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLogIf(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f-> %r)"; } - virtual string emitC() override { return "VL_LOGIF_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "->"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() + INSTR_COUNT_BRANCH; } + string emitVerilog() override { return "%k(%l %f-> %r)"; } + string emitC() override { return "VL_LOGIF_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "->"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() + INSTR_COUNT_BRANCH; } }; class AstLogOr final : public AstNodeBiop { // LOGOR with optional side effects @@ -2001,27 +1995,27 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LogOr; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLogOr(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLogOr(lhs, rhs); } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstLogOr* const sp = static_cast(samep); return m_sideEffect == sp->m_sideEffect; } - virtual void dump(std::ostream& str = std::cout) const override; - virtual string emitVerilog() override { return "%k(%l %f|| %r)"; } - virtual string emitC() override { return "VL_LOGOR_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "||"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() + INSTR_COUNT_BRANCH; } - virtual bool isPure() const override { return !m_sideEffect; } + void dump(std::ostream& str = std::cout) const override; + string emitVerilog() override { return "%k(%l %f|| %r)"; } + string emitC() override { return "VL_LOGOR_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "||"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() + INSTR_COUNT_BRANCH; } + bool isPure() const override { return !m_sideEffect; } void sideEffect(bool flag) { m_sideEffect = flag; } bool sideEffect() const { return m_sideEffect; } }; @@ -2032,20 +2026,20 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_Lt; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLt(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLt(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f< %r)"; } - virtual string emitC() override { return "VL_LT_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "<"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f< %r)"; } + string emitC() override { return "VL_LT_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "<"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstLtD final : public AstNodeBiop { public: @@ -2054,22 +2048,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LtD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLtD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLtD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f< %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "<"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f< %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "<"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } + bool doubleFlavor() const override { return true; } }; class AstLtN final : public AstNodeBiop { public: @@ -2078,22 +2072,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LtN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLtN(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLtN(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f< %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "<"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_STR; } - virtual bool stringFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f< %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "<"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_STR; } + bool stringFlavor() const override { return true; } }; class AstLtS final : public AstNodeBiop { public: @@ -2102,21 +2096,21 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LtS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLtS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLtS(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f< %r)"; } - virtual string emitC() override { return "VL_LTS_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return ""; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f< %r)"; } + string emitC() override { return "VL_LTS_%nq%lq%rq(%lw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return ""; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + bool signedFlavor() const override { return true; } }; class AstLte final : public AstNodeBiop { public: @@ -2125,20 +2119,20 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_Lte; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLte(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLte(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f<= %r)"; } - virtual string emitC() override { return "VL_LTE_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "<="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f<= %r)"; } + string emitC() override { return "VL_LTE_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "<="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstLteD final : public AstNodeBiop { public: @@ -2147,22 +2141,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LteD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLteD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLteD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f<= %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "<="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f<= %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "<="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } + bool doubleFlavor() const override { return true; } }; class AstLteN final : public AstNodeBiop { public: @@ -2171,22 +2165,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LteN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLteN(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLteN(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f<= %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "<="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_STR; } - virtual bool stringFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f<= %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "<="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_STR; } + bool stringFlavor() const override { return true; } }; class AstLteS final : public AstNodeBiop { public: @@ -2195,21 +2189,21 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LteS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLteS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLteS(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f<= %r)"; } - virtual string emitC() override { return "VL_LTES_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return ""; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f<= %r)"; } + string emitC() override { return "VL_LTES_%nq%lq%rq(%lw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return ""; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + bool signedFlavor() const override { return true; } }; class AstModDiv final : public AstNodeBiop { public: @@ -2218,20 +2212,20 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_ModDiv; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstModDiv(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opModDiv(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f%% %r)"; } - virtual string emitC() override { return "VL_MODDIV_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_DIV; } + string emitVerilog() override { return "%k(%l %f%% %r)"; } + string emitC() override { return "VL_MODDIV_%nq%lq%rq(%lw, %P, %li, %ri)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_DIV; } }; class AstModDivS final : public AstNodeBiop { public: @@ -2240,21 +2234,21 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_ModDivS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstModDivS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opModDivS(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f%% %r)"; } - virtual string emitC() override { return "VL_MODDIVS_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_DIV; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f%% %r)"; } + string emitC() override { return "VL_MODDIVS_%nq%lq%rq(%lw, %P, %li, %ri)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_DIV; } + bool signedFlavor() const override { return true; } }; class AstNeqWild final : public AstNodeBiop { public: @@ -2263,20 +2257,20 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_NeqWild; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstNeqWild(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opWildNeq(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f!=? %r)"; } - virtual string emitC() override { return "VL_NEQ_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "!="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f!=? %r)"; } + string emitC() override { return "VL_NEQ_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "!="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstPow final : public AstNodeBiop { public: @@ -2285,21 +2279,21 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_Pow; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstPow(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opPow(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f** %r)"; } - virtual string emitC() override { return "VL_POW_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } - virtual bool emitCheckMaxWords() override { return true; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL * 10; } + string emitVerilog() override { return "%k(%l %f** %r)"; } + string emitC() override { return "VL_POW_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } + bool emitCheckMaxWords() override { return true; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL * 10; } }; class AstPowD final : public AstNodeBiop { public: @@ -2308,21 +2302,21 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_PowD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstPowD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opPowD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f** %r)"; } - virtual string emitC() override { return "pow(%li,%ri)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL_DIV * 5; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f** %r)"; } + string emitC() override { return "pow(%li,%ri)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL_DIV * 5; } + bool doubleFlavor() const override { return true; } }; class AstPowSS final : public AstNodeBiop { public: @@ -2331,24 +2325,22 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_PowSS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstPowSS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opPowSS(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f** %r)"; } - virtual string emitC() override { - return "VL_POWSS_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri, 1,1)"; - } - virtual bool emitCheckMaxWords() override { return true; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL * 10; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f** %r)"; } + string emitC() override { return "VL_POWSS_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri, 1,1)"; } + bool emitCheckMaxWords() override { return true; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL * 10; } + bool signedFlavor() const override { return true; } }; class AstPowSU final : public AstNodeBiop { public: @@ -2357,24 +2349,22 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_PowSU; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstPowSU(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opPowSU(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f** %r)"; } - virtual string emitC() override { - return "VL_POWSS_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri, 1,0)"; - } - virtual bool emitCheckMaxWords() override { return true; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL * 10; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f** %r)"; } + string emitC() override { return "VL_POWSS_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri, 1,0)"; } + bool emitCheckMaxWords() override { return true; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL * 10; } + bool signedFlavor() const override { return true; } }; class AstPowUS final : public AstNodeBiop { public: @@ -2383,24 +2373,22 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_PowUS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstPowUS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opPowUS(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f** %r)"; } - virtual string emitC() override { - return "VL_POWSS_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri, 0,1)"; - } - virtual bool emitCheckMaxWords() override { return true; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL * 10; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f** %r)"; } + string emitC() override { return "VL_POWSS_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri, 0,1)"; } + bool emitCheckMaxWords() override { return true; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL * 10; } + bool signedFlavor() const override { return true; } }; class AstReplicate final : public AstNodeBiop { // Also used as a "Uniop" flavor of Concat, e.g. "{a}" @@ -2417,20 +2405,20 @@ public: AstReplicate(FileLine* fl, AstNode* lhsp, uint32_t repCount) : AstReplicate(fl, lhsp, new AstConst(fl, repCount)) {} ASTGEN_MEMBERS_Replicate; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstReplicate(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opRepl(lhs, rhs); } - virtual string emitVerilog() override { return "%f{%r{%k%l}}"; } - virtual string emitC() override { return "VL_REPLICATE_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 2; } + string emitVerilog() override { return "%f{%r{%k%l}}"; } + string emitC() override { return "VL_REPLICATE_%nq%lq%rq(%lw, %P, %li, %ri)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 2; } }; class AstReplicateN final : public AstNodeBiop { // String replicate @@ -2442,21 +2430,21 @@ public: AstReplicateN(FileLine* fl, AstNode* lhsp, uint32_t repCount) : AstReplicateN(fl, lhsp, new AstConst(fl, repCount)) {} ASTGEN_MEMBERS_ReplicateN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstReplicateN(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opReplN(lhs, rhs); } - virtual string emitVerilog() override { return "%f{%r{%k%l}}"; } - virtual string emitC() override { return "VL_REPLICATEN_NN%rq(%li, %ri)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 2; } - virtual bool stringFlavor() const override { return true; } + string emitVerilog() override { return "%f{%r{%k%l}}"; } + string emitC() override { return "VL_REPLICATEN_NN%rq(%li, %ri)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 2; } + bool stringFlavor() const override { return true; } }; class AstShiftL final : public AstNodeBiop { public: @@ -2465,22 +2453,22 @@ public: if (setwidth) dtypeSetLogicSized(setwidth, VSigning::UNSIGNED); } ASTGEN_MEMBERS_ShiftL; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstShiftL(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opShiftL(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f<< %r)"; } - virtual string emitC() override { return "VL_SHIFTL_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { + string emitVerilog() override { return "%k(%l %f<< %r)"; } + string emitC() override { return "VL_SHIFTL_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return (rhsp()->isWide() || rhsp()->isQuad()) ? "" : "<<"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return false; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return false; } }; class AstShiftR final : public AstNodeBiop { public: @@ -2489,23 +2477,23 @@ public: if (setwidth) dtypeSetLogicSized(setwidth, VSigning::UNSIGNED); } ASTGEN_MEMBERS_ShiftR; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstShiftR(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opShiftR(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f>> %r)"; } - virtual string emitC() override { return "VL_SHIFTR_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { + string emitVerilog() override { return "%k(%l %f>> %r)"; } + string emitC() override { return "VL_SHIFTR_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return (rhsp()->isWide() || rhsp()->isQuad()) ? "" : ">>"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } // LHS size might be > output size, so don't want to force size - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstShiftRS final : public AstNodeBiop { // Shift right with sign extension, >>> operator @@ -2517,21 +2505,21 @@ public: if (setwidth) dtypeSetLogicSized(setwidth, VSigning::SIGNED); } ASTGEN_MEMBERS_ShiftRS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstShiftRS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opShiftRS(lhs, rhs, lhsp()->widthMinV()); } - virtual string emitVerilog() override { return "%k(%l %f>>> %r)"; } - virtual string emitC() override { return "VL_SHIFTRS_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return ""; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f>>> %r)"; } + string emitC() override { return "VL_SHIFTRS_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return ""; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + bool signedFlavor() const override { return true; } }; class AstSub final : public AstNodeBiop { public: @@ -2540,20 +2528,20 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_Sub; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstSub(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opSub(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f- %r)"; } - virtual string emitC() override { return "VL_SUB_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "-"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } + string emitVerilog() override { return "%k(%l %f- %r)"; } + string emitC() override { return "VL_SUB_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "-"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } }; class AstSubD final : public AstNodeBiop { public: @@ -2562,22 +2550,22 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_SubD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstSubD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opSubD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f- %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "-"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f- %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "-"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } + bool doubleFlavor() const override { return true; } }; class AstURandomRange final : public AstNodeBiop { // $urandom_range @@ -2587,22 +2575,22 @@ public: dtypeSetUInt32(); // Says IEEE } ASTGEN_MEMBERS_URandomRange; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstURandomRange(fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { V3ERROR_NA; } - virtual string emitVerilog() override { return "%f$urandom_range(%l, %r)"; } - virtual string emitC() override { return "VL_URANDOM_RANGE_%nq(%li, %ri)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_PLI; } + string emitVerilog() override { return "%f$urandom_range(%l, %r)"; } + string emitC() override { return "VL_URANDOM_RANGE_%nq(%li, %ri)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + int instrCount() const override { return INSTR_COUNT_PLI; } }; // === AstNodeBiCom === @@ -2613,22 +2601,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_Eq; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstEq(this->fileline(), lhsp, rhsp); } static AstNodeBiop* newTyped(FileLine* fl, AstNode* lhsp, AstNode* rhsp); // Return AstEq/AstEqD - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opEq(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f== %r)"; } - virtual string emitC() override { return "VL_EQ_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "=="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f== %r)"; } + string emitC() override { return "VL_EQ_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "=="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstEqCase final : public AstNodeBiCom { public: @@ -2637,20 +2625,20 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_EqCase; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstEqCase(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opCaseEq(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f=== %r)"; } - virtual string emitC() override { return "VL_EQ_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "=="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f=== %r)"; } + string emitC() override { return "VL_EQ_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "=="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstEqD final : public AstNodeBiCom { public: @@ -2659,22 +2647,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_EqD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstEqD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opEqD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f== %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "=="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f== %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "=="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } + bool doubleFlavor() const override { return true; } }; class AstEqN final : public AstNodeBiCom { public: @@ -2683,22 +2671,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_EqN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstEqN(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opEqN(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f== %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "=="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_STR; } - virtual bool stringFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f== %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "=="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_STR; } + bool stringFlavor() const override { return true; } }; class AstLogEq final : public AstNodeBiCom { public: @@ -2707,21 +2695,21 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LogEq; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstLogEq(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opLogEq(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f<-> %r)"; } - virtual string emitC() override { return "VL_LOGEQ_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "<->"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() + INSTR_COUNT_BRANCH; } + string emitVerilog() override { return "%k(%l %f<-> %r)"; } + string emitC() override { return "VL_LOGEQ_%nq%lq%rq(%nw,%lw,%rw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "<->"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() + INSTR_COUNT_BRANCH; } }; class AstNeq final : public AstNodeBiCom { public: @@ -2730,20 +2718,20 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_Neq; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstNeq(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opNeq(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f!= %r)"; } - virtual string emitC() override { return "VL_NEQ_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "!="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f!= %r)"; } + string emitC() override { return "VL_NEQ_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "!="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstNeqCase final : public AstNodeBiCom { public: @@ -2752,20 +2740,20 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_NeqCase; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstNeqCase(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opCaseNeq(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f!== %r)"; } - virtual string emitC() override { return "VL_NEQ_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "!="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f!== %r)"; } + string emitC() override { return "VL_NEQ_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "!="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstNeqD final : public AstNodeBiCom { public: @@ -2774,22 +2762,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_NeqD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstNeqD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opNeqD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f!= %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "!="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f!= %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "!="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } + bool doubleFlavor() const override { return true; } }; class AstNeqN final : public AstNodeBiCom { public: @@ -2798,22 +2786,22 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_NeqN; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstNeqN(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opNeqN(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f!= %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "!="; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_STR; } - virtual bool stringFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f!= %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "!="; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_STR; } + bool stringFlavor() const override { return true; } }; // === AstNodeBiComAsv === @@ -2824,20 +2812,20 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_Add; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAdd(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opAdd(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f+ %r)"; } - virtual string emitC() override { return "VL_ADD_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "+"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } + string emitVerilog() override { return "%k(%l %f+ %r)"; } + string emitC() override { return "VL_ADD_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "+"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } }; class AstAddD final : public AstNodeBiComAsv { public: @@ -2846,22 +2834,22 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_AddD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAddD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opAddD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f+ %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "+"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f+ %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "+"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } + bool doubleFlavor() const override { return true; } }; class AstAnd final : public AstNodeBiComAsv { public: @@ -2870,20 +2858,20 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_And; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAnd(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opAnd(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f& %r)"; } - virtual string emitC() override { return "VL_AND_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "&"; } - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(false); } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f& %r)"; } + string emitC() override { return "VL_AND_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "&"; } + bool cleanOut() const override { V3ERROR_NA_RETURN(false); } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstMul final : public AstNodeBiComAsv { public: @@ -2892,21 +2880,21 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_Mul; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstMul(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opMul(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f* %r)"; } - virtual string emitC() override { return "VL_MUL_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "*"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL; } + string emitVerilog() override { return "%k(%l %f* %r)"; } + string emitC() override { return "VL_MUL_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "*"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL; } }; class AstMulD final : public AstNodeBiComAsv { public: @@ -2915,22 +2903,22 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_MulD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstMulD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opMulD(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f* %r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "*"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } - virtual bool doubleFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f* %r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "*"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + int instrCount() const override { return INSTR_COUNT_DBL; } + bool doubleFlavor() const override { return true; } }; class AstMulS final : public AstNodeBiComAsv { public: @@ -2939,23 +2927,23 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_MulS; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstMulS(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opMulS(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f* %r)"; } - virtual string emitC() override { return "VL_MULS_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return ""; } - virtual bool emitCheckMaxWords() override { return true; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL; } - virtual bool signedFlavor() const override { return true; } + string emitVerilog() override { return "%k(%l %f* %r)"; } + string emitC() override { return "VL_MULS_%nq%lq%rq(%lw, %P, %li, %ri)"; } + string emitSimpleOperator() override { return ""; } + bool emitCheckMaxWords() override { return true; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + int instrCount() const override { return widthInstrs() * INSTR_COUNT_INT_MUL; } + bool signedFlavor() const override { return true; } }; class AstOr final : public AstNodeBiComAsv { public: @@ -2964,20 +2952,20 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_Or; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstOr(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opOr(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f| %r)"; } - virtual string emitC() override { return "VL_OR_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "|"; } - virtual bool cleanOut() const override { V3ERROR_NA_RETURN(false); } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f| %r)"; } + string emitC() override { return "VL_OR_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "|"; } + bool cleanOut() const override { V3ERROR_NA_RETURN(false); } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; class AstXor final : public AstNodeBiComAsv { public: @@ -2986,20 +2974,20 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_Xor; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstXor(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opXor(lhs, rhs); } - virtual string emitVerilog() override { return "%k(%l %f^ %r)"; } - virtual string emitC() override { return "VL_XOR_%lq(%lW, %P, %li, %ri)"; } - virtual string emitSimpleOperator() override { return "^"; } - virtual bool cleanOut() const override { return false; } // Lclean && Rclean - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } + string emitVerilog() override { return "%k(%l %f^ %r)"; } + string emitC() override { return "VL_XOR_%lq(%lW, %P, %li, %ri)"; } + string emitSimpleOperator() override { return "^"; } + bool cleanOut() const override { return false; } // Lclean && Rclean + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } }; // === AstNodeSel === @@ -3024,25 +3012,23 @@ public: init(fromp); } ASTGEN_MEMBERS_ArraySel; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstArraySel(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { V3ERROR_NA; /* How can from be a const? */ } - virtual string emitVerilog() override { return "%k(%l%f[%r])"; } - virtual string emitC() override { return "%li%k[%ri]"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool isGateOptimizable() const override { - return true; - } // esp for V3Const::ifSameAssign - virtual bool isPredictOptimizable() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "%k(%l%f[%r])"; } + string emitC() override { return "%li%k[%ri]"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + 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; } + int instrCount() const override { return widthInstrs(); } // Special operators // Return base var (or const) nodep dereferences static AstNode* baseFromp(AstNode* nodep, bool overMembers); @@ -3064,25 +3050,23 @@ public: init(fromp); } ASTGEN_MEMBERS_AssocSel; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAssocSel(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { V3ERROR_NA; } - virtual string emitVerilog() override { return "%k(%l%f[%r])"; } - virtual string emitC() override { return "%li%k[%ri]"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool isGateOptimizable() const override { - return true; - } // esp for V3Const::ifSameAssign - virtual bool isPredictOptimizable() const override { return false; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "%k(%l%f[%r])"; } + string emitC() override { return "%li%k[%ri]"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + 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; } + int instrCount() const override { return widthInstrs(); } }; class AstWildcardSel final : public AstNodeSel { // Parents: math|stmt @@ -3101,25 +3085,23 @@ public: init(fromp); } ASTGEN_MEMBERS_WildcardSel; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstWildcardSel{this->fileline(), lhsp, rhsp}; } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { V3ERROR_NA; } - virtual string emitVerilog() override { return "%k(%l%f[%r])"; } - virtual string emitC() override { return "%li%k[%ri]"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool isGateOptimizable() const override { - return true; - } // esp for V3Const::ifSameAssign - virtual bool isPredictOptimizable() const override { return false; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + string emitVerilog() override { return "%k(%l%f[%r])"; } + string emitC() override { return "%li%k[%ri]"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + 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; } + int instrCount() const override { return widthInstrs(); } }; class AstWordSel final : public AstNodeSel { // Select a single word from a multi-word wide value @@ -3129,22 +3111,22 @@ public: dtypeSetUInt32(); // Always used on WData arrays so returns edata size } ASTGEN_MEMBERS_WordSel; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstWordSel(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& from, const V3Number& bit) override { + void numberOperate(V3Number& out, const V3Number& from, const V3Number& bit) override { V3ERROR_NA; } - virtual string emitVerilog() override { return "%k(%l%f[%r])"; } - virtual string emitC() override { + string emitVerilog() override { return "%k(%l%f[%r])"; } + string emitC() override { return "%li[%ri]"; } // Not %k, as usually it's a small constant rhsp - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + 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; } }; // === AstNodeStream === @@ -3154,20 +3136,20 @@ public: AstStreamL(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : ASTGEN_SUPER_StreamL(fl, lhsp, rhsp) {} ASTGEN_MEMBERS_StreamL; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstStreamL(this->fileline(), lhsp, rhsp); } - virtual string emitVerilog() override { return "%f{ << %r %k{%l} }"; } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + string emitVerilog() override { return "%f{ << %r %k{%l} }"; } + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opStreamL(lhs, rhs); } - virtual string emitC() override { return "VL_STREAML_%nq%lq%rq(%lw, %P, %li, %ri)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 2; } + string emitC() override { return "VL_STREAML_%nq%lq%rq(%lw, %P, %li, %ri)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 2; } }; class AstStreamR final : public AstNodeStream { // Verilog {rhs{lhs}} - Note rhsp() is the slice size, not the lhsp() @@ -3175,20 +3157,20 @@ public: AstStreamR(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : ASTGEN_SUPER_StreamR(fl, lhsp, rhsp) {} ASTGEN_MEMBERS_StreamR; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstStreamR(this->fileline(), lhsp, rhsp); } - virtual string emitVerilog() override { return "%f{ >> %r %k{%l} }"; } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + string emitVerilog() override { return "%f{ >> %r %k{%l} }"; } + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.opAssign(lhs); } - virtual string emitC() override { return isWide() ? "VL_ASSIGN_W(%nw, %P, %li)" : "%li"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 2; } + string emitC() override { return isWide() ? "VL_ASSIGN_W(%nw, %P, %li)" : "%li"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 2; } }; // === AstNodeSystemBiop === @@ -3197,28 +3179,28 @@ public: AstAtan2D(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : ASTGEN_SUPER_Atan2D(fl, lhsp, rhsp) {} ASTGEN_MEMBERS_Atan2D; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAtan2D(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.setDouble(std::atan2(lhs.toDouble(), rhs.toDouble())); } - virtual string emitVerilog() override { return "%f$atan2(%l,%r)"; } - virtual string emitC() override { return "atan2(%li,%ri)"; } + string emitVerilog() override { return "%f$atan2(%l,%r)"; } + string emitC() override { return "atan2(%li,%ri)"; } }; class AstHypotD final : public AstNodeSystemBiop { public: AstHypotD(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : ASTGEN_SUPER_HypotD(fl, lhsp, rhsp) {} ASTGEN_MEMBERS_HypotD; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstHypotD(this->fileline(), lhsp, rhsp); } - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs) override { out.setDouble(std::hypot(lhs.toDouble(), rhs.toDouble())); } - virtual string emitVerilog() override { return "%f$hypot(%l,%r)"; } - virtual string emitC() override { return "hypot(%li,%ri)"; } + string emitVerilog() override { return "%f$hypot(%l,%r)"; } + string emitC() override { return "hypot(%li,%ri)"; } }; // === AstNodeQuadop === @@ -3233,22 +3215,22 @@ public: AstCountBits(FileLine* fl, AstNode* exprp, AstNode* ctrl1p, AstNode* ctrl2p, AstNode* ctrl3p) : ASTGEN_SUPER_CountBits(fl, exprp, ctrl1p, ctrl2p, ctrl3p) {} ASTGEN_MEMBERS_CountBits; - virtual void numberOperate(V3Number& out, const V3Number& expr, const V3Number& ctrl1, - const V3Number& ctrl2, const V3Number& ctrl3) override { + void numberOperate(V3Number& out, const V3Number& expr, const V3Number& ctrl1, + const V3Number& ctrl2, const V3Number& ctrl3) override { out.opCountBits(expr, ctrl1, ctrl2, ctrl3); } - virtual string emitVerilog() override { return "%f$countbits(%l, %r, %f, %o)"; } - virtual string emitC() override { return ""; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool cleanThs() const override { return true; } - virtual bool cleanFhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool sizeMattersThs() const override { return false; } - virtual bool sizeMattersFhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 16; } + string emitVerilog() override { return "%f$countbits(%l, %r, %f, %o)"; } + string emitC() override { return ""; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool cleanThs() const override { return true; } + bool cleanFhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + bool sizeMattersThs() const override { return false; } + bool sizeMattersFhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 16; } }; // === AstNodeTermop === @@ -3261,14 +3243,14 @@ public: dtypeSetUInt64(); } ASTGEN_MEMBERS_Time; - virtual string emitVerilog() override { return "%f$time"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_TIME; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual void dump(std::ostream& str = std::cout) const override; + string emitVerilog() override { return "%f$time"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } + 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; } + void dump(std::ostream& str = std::cout) const override; void timeunit(const VTimescale& flag) { m_timeunit = flag; } VTimescale timeunit() const { return m_timeunit; } }; @@ -3281,14 +3263,14 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_TimeD; - virtual string emitVerilog() override { return "%f$realtime"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_TIME; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual void dump(std::ostream& str = std::cout) const override; + string emitVerilog() override { return "%f$realtime"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } + 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; } + void dump(std::ostream& str = std::cout) const override; void timeunit(const VTimescale& flag) { m_timeunit = flag; } VTimescale timeunit() const { return m_timeunit; } }; @@ -3304,20 +3286,20 @@ public: AstPostAdd(FileLine* fl, AstNode* lhsp, AstNode* rhsp, AstNode* thsp) : ASTGEN_SUPER_PostAdd(fl, lhsp, rhsp, thsp) {} ASTGEN_MEMBERS_PostAdd; - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, - const V3Number& ths) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, + const V3Number& ths) override { V3ERROR_NA; // Need to modify lhs } - virtual string emitVerilog() override { return "%k(%r++)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool cleanThs() const override { return false; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual bool sizeMattersThs() const override { return true; } + string emitVerilog() override { return "%k(%r++)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool cleanThs() const override { return false; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + bool sizeMattersThs() const override { return true; } }; class AstPostSub final : public AstNodeTriop { // Post-decrement/subtract @@ -3329,20 +3311,20 @@ public: AstPostSub(FileLine* fl, AstNode* lhsp, AstNode* rhsp, AstNode* thsp) : ASTGEN_SUPER_PostSub(fl, lhsp, rhsp, thsp) {} ASTGEN_MEMBERS_PostSub; - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, - const V3Number& ths) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, + const V3Number& ths) override { V3ERROR_NA; // Need to modify lhs } - virtual string emitVerilog() override { return "%k(%r--)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool cleanThs() const override { return false; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual bool sizeMattersThs() const override { return true; } + string emitVerilog() override { return "%k(%r--)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool cleanThs() const override { return false; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + bool sizeMattersThs() const override { return true; } }; class AstPreAdd final : public AstNodeTriop { // Pre-increment/add @@ -3354,20 +3336,20 @@ public: AstPreAdd(FileLine* fl, AstNode* lhsp, AstNode* rhsp, AstNode* thsp) : ASTGEN_SUPER_PreAdd(fl, lhsp, rhsp, thsp) {} ASTGEN_MEMBERS_PreAdd; - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, - const V3Number& ths) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, + const V3Number& ths) override { V3ERROR_NA; // Need to modify lhs } - virtual string emitVerilog() override { return "%k(++%r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool cleanThs() const override { return false; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual bool sizeMattersThs() const override { return true; } + string emitVerilog() override { return "%k(++%r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool cleanThs() const override { return false; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + bool sizeMattersThs() const override { return true; } }; class AstPreSub final : public AstNodeTriop { // Pre-decrement/subtract @@ -3379,20 +3361,20 @@ public: AstPreSub(FileLine* fl, AstNode* lhsp, AstNode* rhsp, AstNode* thsp) : ASTGEN_SUPER_PreSub(fl, lhsp, rhsp, thsp) {} ASTGEN_MEMBERS_PreSub; - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, - const V3Number& ths) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, + const V3Number& ths) override { V3ERROR_NA; // Need to modify lhs } - virtual string emitVerilog() override { return "%k(--%r)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return false; } - virtual bool cleanThs() const override { return false; } - virtual bool sizeMattersLhs() const override { return true; } - virtual bool sizeMattersRhs() const override { return true; } - virtual bool sizeMattersThs() const override { return true; } + string emitVerilog() override { return "%k(--%r)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return false; } + bool cleanThs() const override { return false; } + bool sizeMattersLhs() const override { return true; } + bool sizeMattersRhs() const override { return true; } + bool sizeMattersThs() const override { return true; } }; class AstPutcN final : public AstNodeTriop { // Verilog string.putc() @@ -3402,21 +3384,21 @@ public: dtypeSetString(); } ASTGEN_MEMBERS_PutcN; - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, - const V3Number& ths) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, + const V3Number& ths) override { out.opPutcN(lhs, rhs, ths); } - virtual string name() const override { return "putc"; } - virtual string emitVerilog() override { return "%k(%l.putc(%r,%t))"; } - virtual string emitC() override { return "VL_PUTC_N(%li,%ri,%ti)"; } - virtual string emitSimpleOperator() override { return ""; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool cleanThs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool sizeMattersThs() const override { return false; } + string name() const override { return "putc"; } + string emitVerilog() override { return "%k(%l.putc(%r,%t))"; } + string emitC() override { return "VL_PUTC_N(%li,%ri,%ti)"; } + string emitSimpleOperator() override { return ""; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool cleanThs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + bool sizeMattersThs() const override { return false; } }; class AstSel final : public AstNodeTriop { // Multiple bit range extraction @@ -3441,28 +3423,26 @@ public: dtypeSetLogicSized(bitwidth, VSigning::UNSIGNED); } ASTGEN_MEMBERS_Sel; - virtual void dump(std::ostream& str) const override; - virtual void numberOperate(V3Number& out, const V3Number& from, const V3Number& bit, - const V3Number& width) override { + void dump(std::ostream& str) const override; + void numberOperate(V3Number& out, const V3Number& from, const V3Number& bit, + const V3Number& width) override { out.opSel(from, bit.toUInt() + width.toUInt() - 1, bit.toUInt()); } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { return widthp()->isOne() ? "VL_BITSEL_%nq%lq%rq%tq(%lw, %P, %li, %ri)" : isWide() ? "VL_SEL_%nq%lq%rq%tq(%nw,%lw, %P, %li, %ri, %ti)" : "VL_SEL_%nq%lq%rq%tq(%lw, %P, %li, %ri, %ti)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool cleanThs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool sizeMattersThs() const override { return false; } - virtual bool same(const AstNode*) const override { return true; } - virtual int instrCount() const override { - return widthInstrs() * (VN_CAST(lsbp(), Const) ? 3 : 10); - } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool cleanThs() const override { return true; } + 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; } + int instrCount() const override { return widthInstrs() * (VN_CAST(lsbp(), Const) ? 3 : 10); } AstNode* fromp() const { return op1p(); } // op1 = Extracting what (nullptr=TBD during parsing) @@ -3489,22 +3469,22 @@ public: new AstConst(fl, declRange.elements())) , m_declRange{declRange} {} ASTGEN_MEMBERS_SliceSel; - virtual void dump(std::ostream& str) const override; - virtual void numberOperate(V3Number& out, const V3Number& from, const V3Number& lo, - const V3Number& width) override { + void dump(std::ostream& str) const override; + void numberOperate(V3Number& out, const V3Number& from, const V3Number& lo, + const V3Number& width) override { V3ERROR_NA; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } // Removed before EmitC - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool cleanRhs() const override { return true; } - virtual bool cleanThs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool sizeMattersThs() const override { return false; } - virtual bool same(const AstNode*) const override { return true; } - virtual int instrCount() const override { return 10; } // Removed before matters + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } // Removed before EmitC + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool cleanRhs() const override { return true; } + bool cleanThs() const override { return true; } + 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; } + int instrCount() const override { return 10; } // Removed before matters AstNode* fromp() const { return op1p(); } // op1 = Extracting what (nullptr=TBD during parsing) @@ -3521,21 +3501,21 @@ public: dtypeSetString(); } ASTGEN_MEMBERS_SubstrN; - virtual void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, - const V3Number& ths) override { + void numberOperate(V3Number& out, const V3Number& lhs, const V3Number& rhs, + const V3Number& ths) override { out.opSubstrN(lhs, rhs, ths); } - virtual string name() const override { return "substr"; } - virtual string emitVerilog() override { return "%k(%l.substr(%r,%t))"; } - virtual string emitC() override { return "VL_SUBSTR_N(%li,%ri,%ti)"; } - virtual string emitSimpleOperator() override { return ""; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool cleanRhs() const override { return true; } - virtual bool cleanThs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool sizeMattersRhs() const override { return false; } - virtual bool sizeMattersThs() const override { return false; } + string name() const override { return "substr"; } + string emitVerilog() override { return "%k(%l.substr(%r,%t))"; } + string emitC() override { return "VL_SUBSTR_N(%li,%ri,%ti)"; } + string emitSimpleOperator() override { return ""; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool cleanRhs() const override { return true; } + bool cleanThs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + bool sizeMattersRhs() const override { return false; } + bool sizeMattersThs() const override { return false; } }; // === AstNodeCond === @@ -3547,7 +3527,7 @@ public: AstCond(FileLine* fl, AstNode* condp, AstNode* expr1p, AstNode* expr2p) : ASTGEN_SUPER_Cond(fl, condp, expr1p, expr2p) {} ASTGEN_MEMBERS_Cond; - virtual AstNode* cloneType(AstNode* condp, AstNode* expr1p, AstNode* expr2p) override { + AstNode* cloneType(AstNode* condp, AstNode* expr1p, AstNode* expr2p) override { return new AstCond(this->fileline(), condp, expr1p, expr2p); } }; @@ -3559,7 +3539,7 @@ public: AstCondBound(FileLine* fl, AstNode* condp, AstNode* expr1p, AstNode* expr2p) : ASTGEN_SUPER_CondBound(fl, condp, expr1p, expr2p) {} ASTGEN_MEMBERS_CondBound; - virtual AstNode* cloneType(AstNode* condp, AstNode* expr1p, AstNode* expr2p) override { + AstNode* cloneType(AstNode* condp, AstNode* expr1p, AstNode* expr2p) override { return new AstCondBound(this->fileline(), condp, expr1p, expr2p); } }; @@ -3579,10 +3559,8 @@ public: fmt == ATOREAL ? dtypeSetDouble() : dtypeSetSigned32(); } ASTGEN_MEMBERS_AtoN; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { - out.opAtoN(lhs, m_fmt); - } - virtual string name() const override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opAtoN(lhs, m_fmt); } + string name() const override { switch (m_fmt) { case ATOI: return "atoi"; case ATOHEX: return "atohex"; @@ -3592,8 +3570,8 @@ public: default: V3ERROR_NA; } } - virtual string emitVerilog() override { return "%l." + name() + "()"; } - virtual string emitC() override { + string emitVerilog() override { return "%l." + name() + "()"; } + string emitC() override { switch (m_fmt) { case ATOI: return "VL_ATOI_N(%li, 10)"; case ATOHEX: return "VL_ATOI_N(%li, 16)"; @@ -3603,9 +3581,9 @@ public: default: V3ERROR_NA; } } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } FmtType format() const { return m_fmt; } }; class AstBitsToRealD final : public AstNodeUniop { @@ -3615,15 +3593,13 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_BitsToRealD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { - out.opBitsToRealD(lhs); - } - virtual string emitVerilog() override { return "%f$bitstoreal(%l)"; } - virtual string emitC() override { return "VL_CVT_D_Q(%li)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } // Eliminated before matters - virtual bool sizeMattersLhs() const override { return false; } // Eliminated before matters - virtual int instrCount() const override { return INSTR_COUNT_DBL; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opBitsToRealD(lhs); } + string emitVerilog() override { return "%f$bitstoreal(%l)"; } + string emitC() override { return "VL_CVT_D_Q(%li)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } // Eliminated before matters + bool sizeMattersLhs() const override { return false; } // Eliminated before matters + int instrCount() const override { return INSTR_COUNT_DBL; } }; class AstCCast final : public AstNodeUniop { // Cast to C-based data type @@ -3645,16 +3621,16 @@ public: m_size = width(); } ASTGEN_MEMBERS_CCast; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opAssign(lhs); } - virtual string emitVerilog() override { return "%f$_CAST(%l)"; } - virtual string emitC() override { return "VL_CAST_%nq%lq(%nw,%lw, %P, %li)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } // Special cased in V3Cast - virtual bool same(const AstNode* samep) const override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opAssign(lhs); } + string emitVerilog() override { return "%f$_CAST(%l)"; } + string emitC() override { return "VL_CAST_%nq%lq(%nw,%lw, %P, %li)"; } + 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 { return size() == static_cast(samep)->size(); } - virtual void dump(std::ostream& str = std::cout) const override; + void dump(std::ostream& str = std::cout) const override; // int size() const { return m_size; } }; @@ -3665,13 +3641,13 @@ public: dtypeSetSigned32(); } ASTGEN_MEMBERS_CLog2; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opCLog2(lhs); } - virtual string emitVerilog() override { return "%f$clog2(%l)"; } - virtual string emitC() override { return "VL_CLOG2_%lq(%lW, %P, %li)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 16; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opCLog2(lhs); } + string emitVerilog() override { return "%f$clog2(%l)"; } + string emitC() override { return "VL_CLOG2_%lq(%lW, %P, %li)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 16; } }; class AstCountOnes final : public AstNodeUniop { // Number of bits set in vector @@ -3679,15 +3655,13 @@ public: AstCountOnes(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_CountOnes(fl, lhsp) {} ASTGEN_MEMBERS_CountOnes; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { - out.opCountOnes(lhs); - } - virtual string emitVerilog() override { return "%f$countones(%l)"; } - virtual string emitC() override { return "VL_COUNTONES_%lq(%lW, %P, %li)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 16; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opCountOnes(lhs); } + string emitVerilog() override { return "%f$countones(%l)"; } + string emitC() override { return "VL_COUNTONES_%lq(%lW, %P, %li)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 16; } }; class AstCvtPackString final : public AstNodeUniop { // Convert to Verilator Packed String (aka verilog "string") @@ -3697,13 +3671,13 @@ public: dtypeSetString(); } ASTGEN_MEMBERS_CvtPackString; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { V3ERROR_NA; } - virtual string emitVerilog() override { return "%f$_CAST(%l)"; } - virtual string emitC() override { return "VL_CVT_PACK_STR_N%lq(%lW, %li)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + void numberOperate(V3Number& out, const V3Number& lhs) override { V3ERROR_NA; } + string emitVerilog() override { return "%f$_CAST(%l)"; } + string emitC() override { return "VL_CVT_PACK_STR_N%lq(%lW, %li)"; } + 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; } }; class AstExtend final : public AstNodeUniop { // Expand a value into a wider entity by 0 extension. Width is implied from nodep->width() @@ -3715,15 +3689,15 @@ public: dtypeSetLogicSized(width, VSigning::UNSIGNED); } ASTGEN_MEMBERS_Extend; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opAssign(lhs); } - virtual string emitVerilog() override { return "%l"; } - virtual string emitC() override { return "VL_EXTEND_%nq%lq(%nw,%lw, %P, %li)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opAssign(lhs); } + string emitVerilog() override { return "%l"; } + string emitC() override { return "VL_EXTEND_%nq%lq(%nw,%lw, %P, %li)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; // Because the EXTEND operator self-casts } - virtual int instrCount() const override { return 0; } + int instrCount() const override { return 0; } }; class AstExtendS final : public AstNodeUniop { // Expand a value into a wider entity by sign extension. Width is implied from nodep->width() @@ -3736,34 +3710,32 @@ public: dtypeSetLogicSized(width, VSigning::UNSIGNED); } ASTGEN_MEMBERS_ExtendS; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opExtendS(lhs, lhsp()->widthMinV()); } - virtual string emitVerilog() override { return "%l"; } - virtual string emitC() override { return "VL_EXTENDS_%nq%lq(%nw,%lw, %P, %li)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { + string emitVerilog() override { return "%l"; } + string emitC() override { return "VL_EXTENDS_%nq%lq(%nw,%lw, %P, %li)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; // Because the EXTEND operator self-casts } - virtual int instrCount() const override { return 0; } - virtual bool signedFlavor() const override { return true; } + int instrCount() const override { return 0; } + bool signedFlavor() const override { return true; } }; class AstFEof final : public AstNodeUniop { public: AstFEof(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_FEof(fl, lhsp) {} ASTGEN_MEMBERS_FEof; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { V3ERROR_NA; } - virtual string emitVerilog() override { return "%f$feof(%l)"; } - virtual string emitC() override { return "(%li ? feof(VL_CVT_I_FP(%li)) : true)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 16; } - virtual bool isPure() const override { - return false; - } // SPECIAL: $display has 'visual' ordering + void numberOperate(V3Number& out, const V3Number& lhs) override { V3ERROR_NA; } + string emitVerilog() override { return "%f$feof(%l)"; } + string emitC() override { return "(%li ? feof(VL_CVT_I_FP(%li)) : true)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 16; } + bool isPure() const override { return false; } // SPECIAL: $display has 'visual' ordering AstNode* filep() const { return lhsp(); } }; class AstFGetC final : public AstNodeUniop { @@ -3771,17 +3743,15 @@ public: AstFGetC(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_FGetC(fl, lhsp) {} ASTGEN_MEMBERS_FGetC; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { V3ERROR_NA; } - virtual string emitVerilog() override { return "%f$fgetc(%l)"; } + void numberOperate(V3Number& out, const V3Number& lhs) override { V3ERROR_NA; } + string emitVerilog() override { return "%f$fgetc(%l)"; } // Non-existent filehandle returns EOF - virtual string emitC() override { return "(%li ? fgetc(VL_CVT_I_FP(%li)) : -1)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 64; } - virtual bool isPure() const override { - return false; - } // SPECIAL: $display has 'visual' ordering + string emitC() override { return "(%li ? fgetc(VL_CVT_I_FP(%li)) : -1)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 64; } + bool isPure() const override { return false; } // SPECIAL: $display has 'visual' ordering AstNode* filep() const { return lhsp(); } }; class AstISToRD final : public AstNodeUniop { @@ -3792,14 +3762,14 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_ISToRD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opISToRD(lhs); } - virtual string emitVerilog() override { return "%f$itor($signed(%l))"; } - virtual string emitC() override { return "VL_ISTOR_D_%lq(%lw, %li)"; } - virtual bool emitCheckMaxWords() override { return true; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opISToRD(lhs); } + string emitVerilog() override { return "%f$itor($signed(%l))"; } + string emitC() override { return "VL_ISTOR_D_%lq(%lw, %li)"; } + bool emitCheckMaxWords() override { return true; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } }; class AstIToRD final : public AstNodeUniop { // $itor where lhs is unsigned @@ -3809,13 +3779,13 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_IToRD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opIToRD(lhs); } - virtual string emitVerilog() override { return "%f$itor(%l)"; } - virtual string emitC() override { return "VL_ITOR_D_%lq(%lw, %li)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opIToRD(lhs); } + string emitVerilog() override { return "%f$itor(%l)"; } + string emitC() override { return "VL_ITOR_D_%lq(%lw, %li)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } }; class AstIsUnbounded final : public AstNodeUniop { // True if is unmbounded ($) @@ -3825,15 +3795,15 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_IsUnbounded; - virtual void numberOperate(V3Number& out, const V3Number&) override { + void numberOperate(V3Number& out, const V3Number&) override { // Any constant isn't unbounded out.setZero(); } - virtual string emitVerilog() override { return "%f$isunbounded(%l)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } + string emitVerilog() override { return "%f$isunbounded(%l)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } }; class AstIsUnknown final : public AstNodeUniop { // True if any unknown bits @@ -3843,14 +3813,12 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_IsUnknown; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { - out.opIsUnknown(lhs); - } - virtual string emitVerilog() override { return "%f$isunknown(%l)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opIsUnknown(lhs); } + string emitVerilog() override { return "%f$isunknown(%l)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } }; class AstLenN final : public AstNodeUniop { // Length of a string @@ -3860,12 +3828,12 @@ public: dtypeSetSigned32(); } ASTGEN_MEMBERS_LenN; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opLenN(lhs); } - virtual string emitVerilog() override { return "%f(%l)"; } - virtual string emitC() override { return "VL_LEN_IN(%li)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opLenN(lhs); } + string emitVerilog() override { return "%f(%l)"; } + string emitC() override { return "VL_LEN_IN(%li)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } }; class AstLogNot final : public AstNodeUniop { public: @@ -3874,13 +3842,13 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_LogNot; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opLogNot(lhs); } - virtual string emitVerilog() override { return "%f(! %l)"; } - virtual string emitC() override { return "VL_LOGNOT_%nq%lq(%nw,%lw, %P, %li)"; } - virtual string emitSimpleOperator() override { return "!"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opLogNot(lhs); } + string emitVerilog() override { return "%f(! %l)"; } + string emitC() override { return "VL_LOGNOT_%nq%lq(%nw,%lw, %P, %li)"; } + string emitSimpleOperator() override { return "!"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } }; class AstNegate final : public AstNodeUniop { public: @@ -3889,13 +3857,13 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_Negate; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opNegate(lhs); } - virtual string emitVerilog() override { return "%f(- %l)"; } - virtual string emitC() override { return "VL_NEGATE_%lq(%lW, %P, %li)"; } - virtual string emitSimpleOperator() override { return "-"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return true; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opNegate(lhs); } + string emitVerilog() override { return "%f(- %l)"; } + string emitC() override { return "VL_NEGATE_%lq(%lW, %P, %li)"; } + string emitSimpleOperator() override { return "-"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool sizeMattersLhs() const override { return true; } }; class AstNegateD final : public AstNodeUniop { public: @@ -3904,15 +3872,15 @@ public: dtypeSetDouble(); } ASTGEN_MEMBERS_NegateD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opNegateD(lhs); } - virtual string emitVerilog() override { return "%f(- %l)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { return "-"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } - virtual bool doubleFlavor() const override { return true; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opNegateD(lhs); } + string emitVerilog() override { return "%f(- %l)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { return "-"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } + bool doubleFlavor() const override { return true; } }; class AstNot final : public AstNodeUniop { public: @@ -3921,13 +3889,13 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_Not; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opNot(lhs); } - virtual string emitVerilog() override { return "%f(~ %l)"; } - virtual string emitC() override { return "VL_NOT_%lq(%lW, %P, %li)"; } - virtual string emitSimpleOperator() override { return "~"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return true; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opNot(lhs); } + string emitVerilog() override { return "%f(~ %l)"; } + string emitC() override { return "VL_NOT_%lq(%lW, %P, %li)"; } + string emitSimpleOperator() override { return "~"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool sizeMattersLhs() const override { return true; } }; class AstNullCheck final : public AstNodeUniop { // Return LHS after checking that LHS is non-null @@ -3938,17 +3906,15 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_NullCheck; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { V3ERROR_NA; } - virtual int instrCount() const override { return 1; } // Rarely executes - virtual string emitVerilog() override { return "%l"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual bool same(const AstNode* samep) const override { - return fileline() == samep->fileline(); - } + void numberOperate(V3Number& out, const V3Number& lhs) override { V3ERROR_NA; } + int instrCount() const override { return 1; } // Rarely executes + string emitVerilog() override { return "%l"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + string emitSimpleOperator() override { V3ERROR_NA_RETURN(""); } + 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(); } }; class AstOneHot final : public AstNodeUniop { // True if only single bit set in vector @@ -3958,13 +3924,13 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_OneHot; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opOneHot(lhs); } - virtual string emitVerilog() override { return "%f$onehot(%l)"; } - virtual string emitC() override { return "VL_ONEHOT_%lq(%lW, %P, %li)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 4; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opOneHot(lhs); } + string emitVerilog() override { return "%f$onehot(%l)"; } + string emitC() override { return "VL_ONEHOT_%lq(%lW, %P, %li)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 4; } }; class AstOneHot0 final : public AstNodeUniop { // True if only single bit, or no bits set in vector @@ -3974,13 +3940,13 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_OneHot0; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opOneHot0(lhs); } - virtual string emitVerilog() override { return "%f$onehot0(%l)"; } - virtual string emitC() override { return "VL_ONEHOT0_%lq(%lW, %P, %li)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 3; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opOneHot0(lhs); } + string emitVerilog() override { return "%f$onehot0(%l)"; } + string emitC() override { return "VL_ONEHOT0_%lq(%lW, %P, %li)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return widthInstrs() * 3; } }; class AstRToIRoundS final : public AstNodeUniop { // Convert real to integer, with arbitrary sized output (not just "integer" format) @@ -3990,17 +3956,15 @@ public: dtypeSetSigned32(); } ASTGEN_MEMBERS_RToIRoundS; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { - out.opRToIRoundS(lhs); - } - virtual string emitVerilog() override { return "%f$rtoi_rounded(%l)"; } - virtual string emitC() override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opRToIRoundS(lhs); } + string emitVerilog() override { return "%f$rtoi_rounded(%l)"; } + string emitC() override { return isWide() ? "VL_RTOIROUND_%nq_D(%nw, %P, %li)" : "VL_RTOIROUND_%nq_D(%li)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_DBL; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return INSTR_COUNT_DBL; } }; class AstRToIS final : public AstNodeUniop { // $rtoi(lhs) @@ -4010,13 +3974,13 @@ public: dtypeSetSigned32(); } ASTGEN_MEMBERS_RToIS; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opRToIS(lhs); } - virtual string emitVerilog() override { return "%f$rtoi(%l)"; } - virtual string emitC() override { return "VL_RTOI_I_D(%li)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } // Eliminated before matters - virtual bool sizeMattersLhs() const override { return false; } // Eliminated before matters - virtual int instrCount() const override { return INSTR_COUNT_DBL; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opRToIS(lhs); } + string emitVerilog() override { return "%f$rtoi(%l)"; } + string emitC() override { return "VL_RTOI_I_D(%li)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } // Eliminated before matters + bool sizeMattersLhs() const override { return false; } // Eliminated before matters + int instrCount() const override { return INSTR_COUNT_DBL; } }; class AstRealToBits final : public AstNodeUniop { public: @@ -4025,15 +3989,13 @@ public: dtypeSetUInt64(); } ASTGEN_MEMBERS_RealToBits; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { - out.opRealToBits(lhs); - } - virtual string emitVerilog() override { return "%f$realtobits(%l)"; } - virtual string emitC() override { return "VL_CVT_Q_D(%li)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } // Eliminated before matters - virtual bool sizeMattersLhs() const override { return false; } // Eliminated before matters - virtual int instrCount() const override { return INSTR_COUNT_DBL; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opRealToBits(lhs); } + string emitVerilog() override { return "%f$realtobits(%l)"; } + string emitC() override { return "VL_CVT_Q_D(%li)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } // Eliminated before matters + bool sizeMattersLhs() const override { return false; } // Eliminated before matters + int instrCount() const override { return INSTR_COUNT_DBL; } }; class AstRedAnd final : public AstNodeUniop { public: @@ -4042,12 +4004,12 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_RedAnd; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opRedAnd(lhs); } - virtual string emitVerilog() override { return "%f(& %l)"; } - virtual string emitC() override { return "VL_REDAND_%nq%lq(%lw, %P, %li)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opRedAnd(lhs); } + string emitVerilog() override { return "%f(& %l)"; } + string emitC() override { return "VL_REDAND_%nq%lq(%lw, %P, %li)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } }; class AstRedOr final : public AstNodeUniop { public: @@ -4056,12 +4018,12 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_RedOr; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opRedOr(lhs); } - virtual string emitVerilog() override { return "%f(| %l)"; } - virtual string emitC() override { return "VL_REDOR_%lq(%lW, %P, %li)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opRedOr(lhs); } + string emitVerilog() override { return "%f(| %l)"; } + string emitC() override { return "VL_REDOR_%lq(%lW, %P, %li)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } }; class AstRedXor final : public AstNodeUniop { public: @@ -4070,16 +4032,16 @@ public: dtypeSetBit(); } ASTGEN_MEMBERS_RedXor; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { out.opRedXor(lhs); } - virtual string emitVerilog() override { return "%f(^ %l)"; } - virtual string emitC() override { return "VL_REDXOR_%lq(%lW, %P, %li)"; } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opRedXor(lhs); } + string emitVerilog() override { return "%f(^ %l)"; } + string emitC() override { return "VL_REDXOR_%lq(%lW, %P, %li)"; } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { const int w = lhsp()->width(); return (w != 1 && w != 2 && w != 4 && w != 8 && w != 16); } - virtual bool sizeMattersLhs() const override { return false; } - virtual int instrCount() const override { return 1 + V3Number::log2b(width()); } + bool sizeMattersLhs() const override { return false; } + int instrCount() const override { return 1 + V3Number::log2b(width()); } }; class AstSigned final : public AstNodeUniop { // $signed(lhs) @@ -4090,16 +4052,16 @@ public: "not coded to create after dtypes resolved"); } ASTGEN_MEMBERS_Signed; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opAssign(lhs); out.isSigned(false); } - virtual string emitVerilog() override { return "%f$signed(%l)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } // Eliminated before matters - virtual bool sizeMattersLhs() const override { return true; } // Eliminated before matters - virtual int instrCount() const override { return 0; } + string emitVerilog() override { return "%f$signed(%l)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } // Eliminated before matters + bool sizeMattersLhs() const override { return true; } // Eliminated before matters + int instrCount() const override { return 0; } }; class AstTimeImport final : public AstNodeUniop { // Take a constant that represents a time and needs conversion based on time units @@ -4108,13 +4070,13 @@ public: AstTimeImport(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_TimeImport(fl, lhsp) {} ASTGEN_MEMBERS_TimeImport; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { V3ERROR_NA; } - virtual string emitVerilog() override { return "%l"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } - virtual bool sizeMattersLhs() const override { return false; } - virtual void dump(std::ostream& str = std::cout) const override; + void numberOperate(V3Number& out, const V3Number& lhs) override { V3ERROR_NA; } + string emitVerilog() override { return "%l"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } + bool sizeMattersLhs() const override { return false; } + void dump(std::ostream& str = std::cout) const override; void timeunit(const VTimescale& flag) { m_timeunit = flag; } VTimescale timeunit() const { return m_timeunit; } }; @@ -4126,14 +4088,12 @@ public: dtypeSetString(); } ASTGEN_MEMBERS_ToLowerN; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { - out.opToLowerN(lhs); - } - virtual string emitVerilog() override { return "%l.tolower()"; } - virtual string emitC() override { return "VL_TOLOWER_NN(%li)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opToLowerN(lhs); } + string emitVerilog() override { return "%l.tolower()"; } + string emitC() override { return "VL_TOLOWER_NN(%li)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } }; class AstToUpperN final : public AstNodeUniop { // string.toupper() @@ -4143,14 +4103,12 @@ public: dtypeSetString(); } ASTGEN_MEMBERS_ToUpperN; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { - out.opToUpperN(lhs); - } - virtual string emitVerilog() override { return "%l.toupper()"; } - virtual string emitC() override { return "VL_TOUPPER_NN(%li)"; } - virtual bool cleanOut() const override { return true; } - virtual bool cleanLhs() const override { return true; } - virtual bool sizeMattersLhs() const override { return false; } + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opToUpperN(lhs); } + string emitVerilog() override { return "%l.toupper()"; } + string emitC() override { return "VL_TOUPPER_NN(%li)"; } + bool cleanOut() const override { return true; } + bool cleanLhs() const override { return true; } + bool sizeMattersLhs() const override { return false; } }; class AstUnsigned final : public AstNodeUniop { // $unsigned(lhs) @@ -4161,16 +4119,16 @@ public: "not coded to create after dtypes resolved"); } ASTGEN_MEMBERS_Unsigned; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.opAssign(lhs); out.isSigned(false); } - virtual string emitVerilog() override { return "%f$unsigned(%l)"; } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return false; } - virtual bool cleanLhs() const override { return false; } // Eliminated before matters - virtual bool sizeMattersLhs() const override { return true; } // Eliminated before matters - virtual int instrCount() const override { return 0; } + string emitVerilog() override { return "%f$unsigned(%l)"; } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return false; } + bool cleanLhs() const override { return false; } // Eliminated before matters + bool sizeMattersLhs() const override { return true; } // Eliminated before matters + int instrCount() const override { return 0; } }; // === AstNodeSystemUniop === @@ -4179,198 +4137,198 @@ public: AstAcosD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_AcosD(fl, lhsp) {} ASTGEN_MEMBERS_AcosD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::acos(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$acos(%l)"; } - virtual string emitC() override { return "acos(%li)"; } + string emitVerilog() override { return "%f$acos(%l)"; } + string emitC() override { return "acos(%li)"; } }; class AstAcoshD final : public AstNodeSystemUniop { public: AstAcoshD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_AcoshD(fl, lhsp) {} ASTGEN_MEMBERS_AcoshD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::acosh(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$acosh(%l)"; } - virtual string emitC() override { return "acosh(%li)"; } + string emitVerilog() override { return "%f$acosh(%l)"; } + string emitC() override { return "acosh(%li)"; } }; class AstAsinD final : public AstNodeSystemUniop { public: AstAsinD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_AsinD(fl, lhsp) {} ASTGEN_MEMBERS_AsinD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::asin(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$asin(%l)"; } - virtual string emitC() override { return "asin(%li)"; } + string emitVerilog() override { return "%f$asin(%l)"; } + string emitC() override { return "asin(%li)"; } }; class AstAsinhD final : public AstNodeSystemUniop { public: AstAsinhD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_AsinhD(fl, lhsp) {} ASTGEN_MEMBERS_AsinhD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::asinh(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$asinh(%l)"; } - virtual string emitC() override { return "asinh(%li)"; } + string emitVerilog() override { return "%f$asinh(%l)"; } + string emitC() override { return "asinh(%li)"; } }; class AstAtanD final : public AstNodeSystemUniop { public: AstAtanD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_AtanD(fl, lhsp) {} ASTGEN_MEMBERS_AtanD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::atan(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$atan(%l)"; } - virtual string emitC() override { return "atan(%li)"; } + string emitVerilog() override { return "%f$atan(%l)"; } + string emitC() override { return "atan(%li)"; } }; class AstAtanhD final : public AstNodeSystemUniop { public: AstAtanhD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_AtanhD(fl, lhsp) {} ASTGEN_MEMBERS_AtanhD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::atanh(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$atanh(%l)"; } - virtual string emitC() override { return "atanh(%li)"; } + string emitVerilog() override { return "%f$atanh(%l)"; } + string emitC() override { return "atanh(%li)"; } }; class AstCeilD final : public AstNodeSystemUniop { public: AstCeilD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_CeilD(fl, lhsp) {} ASTGEN_MEMBERS_CeilD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::ceil(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$ceil(%l)"; } - virtual string emitC() override { return "ceil(%li)"; } + string emitVerilog() override { return "%f$ceil(%l)"; } + string emitC() override { return "ceil(%li)"; } }; class AstCosD final : public AstNodeSystemUniop { public: AstCosD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_CosD(fl, lhsp) {} ASTGEN_MEMBERS_CosD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::cos(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$cos(%l)"; } - virtual string emitC() override { return "cos(%li)"; } + string emitVerilog() override { return "%f$cos(%l)"; } + string emitC() override { return "cos(%li)"; } }; class AstCoshD final : public AstNodeSystemUniop { public: AstCoshD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_CoshD(fl, lhsp) {} ASTGEN_MEMBERS_CoshD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::cosh(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$cosh(%l)"; } - virtual string emitC() override { return "cosh(%li)"; } + string emitVerilog() override { return "%f$cosh(%l)"; } + string emitC() override { return "cosh(%li)"; } }; class AstExpD final : public AstNodeSystemUniop { public: AstExpD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_ExpD(fl, lhsp) {} ASTGEN_MEMBERS_ExpD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::exp(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$exp(%l)"; } - virtual string emitC() override { return "exp(%li)"; } + string emitVerilog() override { return "%f$exp(%l)"; } + string emitC() override { return "exp(%li)"; } }; class AstFloorD final : public AstNodeSystemUniop { public: AstFloorD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_FloorD(fl, lhsp) {} ASTGEN_MEMBERS_FloorD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::floor(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$floor(%l)"; } - virtual string emitC() override { return "floor(%li)"; } + string emitVerilog() override { return "%f$floor(%l)"; } + string emitC() override { return "floor(%li)"; } }; class AstLog10D final : public AstNodeSystemUniop { public: AstLog10D(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_Log10D(fl, lhsp) {} ASTGEN_MEMBERS_Log10D; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::log10(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$log10(%l)"; } - virtual string emitC() override { return "log10(%li)"; } + string emitVerilog() override { return "%f$log10(%l)"; } + string emitC() override { return "log10(%li)"; } }; class AstLogD final : public AstNodeSystemUniop { public: AstLogD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_LogD(fl, lhsp) {} ASTGEN_MEMBERS_LogD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::log(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$ln(%l)"; } - virtual string emitC() override { return "log(%li)"; } + string emitVerilog() override { return "%f$ln(%l)"; } + string emitC() override { return "log(%li)"; } }; class AstSinD final : public AstNodeSystemUniop { public: AstSinD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_SinD(fl, lhsp) {} ASTGEN_MEMBERS_SinD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::sin(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$sin(%l)"; } - virtual string emitC() override { return "sin(%li)"; } + string emitVerilog() override { return "%f$sin(%l)"; } + string emitC() override { return "sin(%li)"; } }; class AstSinhD final : public AstNodeSystemUniop { public: AstSinhD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_SinhD(fl, lhsp) {} ASTGEN_MEMBERS_SinhD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::sinh(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$sinh(%l)"; } - virtual string emitC() override { return "sinh(%li)"; } + string emitVerilog() override { return "%f$sinh(%l)"; } + string emitC() override { return "sinh(%li)"; } }; class AstSqrtD final : public AstNodeSystemUniop { public: AstSqrtD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_SqrtD(fl, lhsp) {} ASTGEN_MEMBERS_SqrtD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::sqrt(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$sqrt(%l)"; } - virtual string emitC() override { return "sqrt(%li)"; } + string emitVerilog() override { return "%f$sqrt(%l)"; } + string emitC() override { return "sqrt(%li)"; } }; class AstTanD final : public AstNodeSystemUniop { public: AstTanD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_TanD(fl, lhsp) {} ASTGEN_MEMBERS_TanD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::tan(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$tan(%l)"; } - virtual string emitC() override { return "tan(%li)"; } + string emitVerilog() override { return "%f$tan(%l)"; } + string emitC() override { return "tan(%li)"; } }; class AstTanhD final : public AstNodeSystemUniop { public: AstTanhD(FileLine* fl, AstNode* lhsp) : ASTGEN_SUPER_TanhD(fl, lhsp) {} ASTGEN_MEMBERS_TanhD; - virtual void numberOperate(V3Number& out, const V3Number& lhs) override { + void numberOperate(V3Number& out, const V3Number& lhs) override { out.setDouble(std::tanh(lhs.toDouble())); } - virtual string emitVerilog() override { return "%f$tanh(%l)"; } - virtual string emitC() override { return "tanh(%li)"; } + string emitVerilog() override { return "%f$tanh(%l)"; } + string emitC() override { return "tanh(%li)"; } }; // === AstNodeVarRef === @@ -4385,16 +4343,16 @@ public: // This form only allowed post-link (see above) inline AstVarRef(FileLine* fl, AstVarScope* varscp, const VAccess& access); ASTGEN_MEMBERS_VarRef; - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; bool same(const AstNode* samep) const override; inline bool same(const AstVarRef* samep) const; inline bool sameNoLvalue(AstVarRef* samep) const; - virtual int instrCount() const override { + int instrCount() const override { return widthInstrs() * (access().isReadOrRW() ? INSTR_COUNT_LD : 1); } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + string emitC() override { V3ERROR_NA_RETURN(""); } + bool cleanOut() const override { return true; } }; class AstVarXRef final : public AstNodeVarRef { // A VarRef to something in another module before AstScope. @@ -4408,16 +4366,16 @@ public: , m_dotted{dotted} {} inline AstVarXRef(FileLine* fl, AstVar* varp, const string& dotted, const VAccess& access); ASTGEN_MEMBERS_VarXRef; - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; string dotted() const { return m_dotted; } void dotted(const string& dotted) { m_dotted = dotted; } string inlinedDots() const { return m_inlinedDots; } void inlinedDots(const string& flag) { m_inlinedDots = flag; } - virtual string emitVerilog() override { V3ERROR_NA_RETURN(""); } - virtual string emitC() override { V3ERROR_NA_RETURN(""); } - virtual bool cleanOut() const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } - virtual bool same(const AstNode* samep) const override { + string emitVerilog() override { V3ERROR_NA_RETURN(""); } + 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 { const AstVarXRef* asamep = static_cast(samep); return (selfPointer() == asamep->selfPointer() && varp() == asamep->varp() && name() == asamep->name() && dotted() == asamep->dotted()); diff --git a/src/V3AstNodeOther.h b/src/V3AstNodeOther.h index da62b28d3..e3d56b736 100644 --- a/src/V3AstNodeOther.h +++ b/src/V3AstNodeOther.h @@ -47,9 +47,9 @@ protected: public: ASTGEN_MEMBERS_NodeBlock; - virtual void dump(std::ostream& str) const override; - virtual string name() const override { return m_name; } // * = Block name - virtual void name(const string& name) override { m_name = name; } + void dump(std::ostream& str) const override; + string name() const override { return m_name; } // * = Block name + void name(const string& name) override { m_name = name; } // op1 = Statements AstNode* stmtsp() const { return op1p(); } // op1 = List of statements void addStmtsp(AstNode* nodep) { addNOp1p(nodep); } @@ -112,14 +112,12 @@ protected: public: ASTGEN_MEMBERS_NodeFTask; - virtual void dump(std::ostream& str = std::cout) const override; - virtual string name() const override { return m_name; } // * = Var name - virtual bool maybePointedTo() const override { return true; } - virtual bool isGateOptimizable() const override { - return !((m_dpiExport || m_dpiImport) && !m_pure); - } + void dump(std::ostream& str = std::cout) const override; + string name() const override { return m_name; } // * = Var name + bool maybePointedTo() const override { return true; } + bool isGateOptimizable() const override { return !((m_dpiExport || m_dpiImport) && !m_pure); } // {AstFunc only} op1 = Range output variable - virtual void name(const string& name) override { m_name = name; } + void name(const string& name) override { m_name = name; } string cname() const { return m_cname; } void cname(const string& cname) { m_cname = cname; } // op1 = Output variable (functions only, nullptr for tasks) @@ -194,9 +192,9 @@ public: : AstNode{t, fl} , m_name{name} {} ASTGEN_MEMBERS_NodeFile; - virtual void dump(std::ostream& str) const override; - virtual string name() const override { return m_name; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + void dump(std::ostream& str) const override; + string name() const override { return m_name; } + bool same(const AstNode* /*samep*/) const override { return true; } void tblockp(AstTextBlock* tblockp) { setOp1p((AstNode*)tblockp); } AstTextBlock* tblockp() { return VN_AS(op1p(), TextBlock); } }; @@ -237,9 +235,9 @@ protected: public: ASTGEN_MEMBERS_NodeModule; - virtual void dump(std::ostream& str) const override; - virtual bool maybePointedTo() const override { return true; } - virtual string name() const override { return m_name; } + void dump(std::ostream& str) const override; + bool maybePointedTo() const override { return true; } + string name() const override { return m_name; } virtual bool timescaleMatters() const = 0; AstNode* stmtsp() const { return op2p(); } // op2 = List of statements AstActive* activesp() const { return VN_AS(op3p(), Active); } // op3 = List of i/sblocks @@ -248,8 +246,8 @@ public: void addStmtp(AstNode* nodep) { addNOp2p(nodep); } void addActivep(AstNode* nodep) { addOp3p(nodep); } // ACCESSORS - virtual void name(const string& name) override { m_name = name; } - virtual string origName() const override { return m_origName; } + void name(const string& name) override { m_name = name; } + string origName() const override { return m_origName; } string someInstanceName() const { return m_someInstanceName; } void someInstanceName(const string& name) { m_someInstanceName = name; } bool inLibrary() const { return m_inLibrary; } @@ -299,7 +297,7 @@ public: void thsp(AstNode* nodep) { return setOp3p(nodep); } void attrp(AstAttrOf* nodep) { return setOp4p(reinterpret_cast(nodep)); } // METHODS - virtual bool same(const AstNode*) const override { return true; } + bool same(const AstNode*) const override { return true; } }; class AstNodeProcedure VL_NOT_FINAL : public AstNode { // IEEE procedure: initial, final, always @@ -312,7 +310,7 @@ protected: public: ASTGEN_MEMBERS_NodeProcedure; // METHODS - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; AstNode* bodysp() const { return op2p(); } // op2 = Statements to evaluate void addStmtp(AstNode* nodep) { addOp2p(nodep); } bool isJustOneBodyStmt() const { return bodysp() && !bodysp()->nextp(); } @@ -325,7 +323,7 @@ protected: public: ASTGEN_MEMBERS_NodeRange; - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; }; class AstNodeStmt VL_NOT_FINAL : public AstNode { // Statement -- anything that's directly under a function @@ -340,11 +338,11 @@ public: // METHODS bool isStatement() const { return m_statement; } // Really a statement void statement(bool flag) { m_statement = flag; } - virtual void addNextStmt(AstNode* newp, - AstNode* belowp) override; // Stop statement searchback here - virtual void addBeforeStmt(AstNode* newp, - AstNode* belowp) override; // Stop statement searchback here - virtual void dump(std::ostream& str = std::cout) const override; + void addNextStmt(AstNode* newp, + AstNode* belowp) override; // Stop statement searchback here + void addBeforeStmt(AstNode* newp, + AstNode* belowp) override; // Stop statement searchback here + void dump(std::ostream& str = std::cout) const override; }; class AstNodeAssign VL_NOT_FINAL : public AstNodeStmt { protected: @@ -369,11 +367,11 @@ public: void addTimingControlp(AstNode* const np) { addNOp3p(np); } void rhsp(AstNode* np) { setOp1p(np); } void lhsp(AstNode* np) { setOp2p(np); } - virtual bool hasDType() const override { return true; } + bool hasDType() const override { return true; } virtual bool cleanRhs() const { return true; } - virtual int instrCount() const override { return widthInstrs(); } - virtual bool same(const AstNode*) const override { return true; } - virtual string verilogKwd() const override { return "="; } + int instrCount() const override { return widthInstrs(); } + bool same(const AstNode*) const override { return true; } + string verilogKwd() const override { return "="; } virtual bool brokeLhsMustBeLvalue() const = 0; }; class AstNodeCCall VL_NOT_FINAL : public AstNodeStmt { @@ -391,19 +389,19 @@ protected: public: ASTGEN_MEMBERS_NodeCCall; - virtual void dump(std::ostream& str = std::cout) const override; - virtual void cloneRelink() override; - virtual const char* broken() const override; - virtual int instrCount() const override { return INSTR_COUNT_CALL; } - virtual bool same(const AstNode* samep) const override { + void dump(std::ostream& str = std::cout) const override; + void cloneRelink() override; + const char* broken() const override; + int instrCount() const override { return INSTR_COUNT_CALL; } + bool same(const AstNode* samep) const override { const AstNodeCCall* const asamep = static_cast(samep); return (funcp() == asamep->funcp() && argTypes() == asamep->argTypes()); } AstNode* exprsp() const { return op2p(); } // op2 = expressions to print - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override; - virtual bool isOutputter() const override { return !isPure(); } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override; + bool isOutputter() const override { return !isPure(); } AstCFunc* funcp() const { return m_funcp; } void funcp(AstCFunc* funcp) { m_funcp = funcp; } void argTypes(const string& str) { m_argTypes = str; } @@ -422,7 +420,7 @@ protected: public: ASTGEN_MEMBERS_NodeCase; - virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } + int instrCount() const override { return INSTR_COUNT_BRANCH; } AstNode* exprp() const { return op1p(); } // op1 = case condition AstCaseItem* itemsp() const { return VN_AS(op2p(), CaseItem); @@ -448,10 +446,10 @@ public: addNOp4p(passsp); } ASTGEN_MEMBERS_NodeCoverOrAssert; - virtual string name() const override { return m_name; } // * = Var name - virtual bool same(const AstNode* samep) const override { return samep->name() == name(); } - virtual void name(const string& name) override { m_name = name; } - virtual void dump(std::ostream& str = std::cout) const override; + string name() const override { return m_name; } // * = Var name + bool same(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; AstNode* propp() const { return op1p(); } // op1 = property AstSenTree* sentreep() const { return VN_AS(op2p(), SenTree); } // op2 = clock domain void sentreep(AstSenTree* sentreep) { addOp2p((AstNode*)sentreep); } // op2 = clock domain @@ -482,19 +480,17 @@ protected: public: ASTGEN_MEMBERS_NodeFTaskRef; - virtual const char* broken() const override; - virtual void cloneRelink() override; - virtual void dump(std::ostream& str = std::cout) const override; - virtual string name() const override { return m_name; } // * = Var name - virtual bool isGateOptimizable() const override { - return m_taskp && m_taskp->isGateOptimizable(); - } + const char* broken() const override; + void cloneRelink() override; + void dump(std::ostream& str = std::cout) const override; + string name() const override { return m_name; } // * = Var name + bool isGateOptimizable() const override { return m_taskp && m_taskp->isGateOptimizable(); } string dotted() const { return m_dotted; } // * = Scope name or "" string inlinedDots() const { return m_inlinedDots; } void inlinedDots(const string& flag) { m_inlinedDots = flag; } AstNodeFTask* taskp() const { return m_taskp; } // [After Link] Pointer to variable void taskp(AstNodeFTask* taskp) { m_taskp = taskp; } - virtual void name(const string& name) override { m_name = name; } + void name(const string& name) override { m_name = name; } void dotted(const string& name) { m_dotted = name; } AstNodeModule* classOrPackagep() const { return m_classOrPackagep; } void classOrPackagep(AstNodeModule* nodep) { m_classOrPackagep = nodep; } @@ -527,9 +523,9 @@ public: AstNode* condp() const { return op2p(); } // op2 = condition to continue AstNode* incsp() const { return op3p(); } // op3 = increment statements AstNode* bodysp() const { return op4p(); } // op4 = body of loop - virtual bool isGateOptimizable() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool isGateOptimizable() const override { return false; } + int instrCount() const override { return INSTR_COUNT_BRANCH; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstNodeIf VL_NOT_FINAL : public AstNodeStmt { private: @@ -552,10 +548,10 @@ public: void condp(AstNode* newp) { setOp1p(newp); } void addIfsp(AstNode* newp) { addOp2p(newp); } void addElsesp(AstNode* newp) { addOp3p(newp); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isGateDedupable() const override { return true; } - virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + 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; } void branchPred(VBranchPred flag) { m_branchPred = flag; } VBranchPred branchPred() const { return m_branchPred; } void isBoundsCheck(bool flag) { m_isBoundsCheck = flag; } @@ -578,12 +574,12 @@ public: setNOp4p(msbp); } ASTGEN_MEMBERS_NodeReadWriteMem; - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual bool isUnlikely() const override { return true; } - virtual bool same(const AstNode* samep) const override { + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + bool isUnlikely() const override { return true; } + bool same(const AstNode* samep) const override { return isHex() == static_cast(samep)->isHex(); } bool isHex() const { return m_isHex; } @@ -605,8 +601,8 @@ protected: public: ASTGEN_MEMBERS_NodeText; - virtual void dump(std::ostream& str = std::cout) const override; - virtual bool same(const AstNode* samep) const override { + void dump(std::ostream& str = std::cout) const override; + bool same(const AstNode* samep) const override { const AstNodeText* asamep = static_cast(samep); return text() == asamep->text(); } @@ -643,8 +639,8 @@ public: UASSERT(sensesp, "Sensesp required arg"); } ASTGEN_MEMBERS_Active; - virtual void dump(std::ostream& str = std::cout) const override; - virtual string name() const override { return m_name; } + void dump(std::ostream& str = std::cout) const override; + string name() const override { return m_name; } const char* broken() const override; void cloneRelink() override; // Statements are broken into pieces, as some must come before others. @@ -672,8 +668,8 @@ public: setNOp1p(exprp); } ASTGEN_MEMBERS_Arg; - virtual string name() const override { return m_name; } // * = Pin name, ""=go by number - virtual void name(const string& name) override { m_name = name; } + string name() const override { return m_name; } // * = Pin name, ""=go by number + void name(const string& name) override { m_name = name; } void exprp(AstNode* nodep) { addOp1p(nodep); } // op1 = Expression connected to pin, nullptr if unconnected AstNode* exprp() const { return op1p(); } @@ -694,7 +690,7 @@ public: AstNode* fromp() const { return op1p(); } AstNode* dimp() const { return op2p(); } VAttrType attrType() const { return m_attrType; } - virtual void dump(std::ostream& str = std::cout) const override; + void dump(std::ostream& str = std::cout) const override; }; class AstBind final : public AstNode { // Parents: MODULE @@ -710,8 +706,8 @@ public: } ASTGEN_MEMBERS_Bind; // ACCESSORS - virtual string name() const override { return m_name; } // * = Bind Target name - virtual void name(const string& name) override { m_name = name; } + string name() const override { return m_name; } // * = Bind Target name + void name(const string& name) override { m_name = name; } AstNode* cellsp() const { return op1p(); } // op1 = cells }; class AstCFunc final : public AstNode { @@ -779,12 +775,12 @@ public: m_dpiTraceInit = false; } ASTGEN_MEMBERS_CFunc; - virtual string name() const override { return m_name; } + string name() const override { return m_name; } const char* broken() const override; void cloneRelink() override; - virtual bool maybePointedTo() const override { return true; } - virtual void dump(std::ostream& str = std::cout) const override; - virtual bool same(const AstNode* samep) const override { + bool maybePointedTo() const override { return true; } + void dump(std::ostream& str = std::cout) const override; + bool same(const AstNode* samep) const override { const AstCFunc* const asamep = static_cast(samep); return ((isTrace() == asamep->isTrace()) && (rtnTypeVoid() == asamep->rtnTypeVoid()) && (argTypes() == asamep->argTypes()) && (ctorInits() == asamep->ctorInits()) @@ -792,8 +788,8 @@ public: && (!(dpiImportPrototype() || dpiExportImpl()) || name() == asamep->name())); } // - virtual void name(const string& name) override { m_name = name; } - virtual int instrCount() const override { + void name(const string& name) override { m_name = name; } + int instrCount() const override { return dpiImportPrototype() ? v3Global.opt.instrCountDpi() : 0; } VBoolOrUnknown isConst() const { return m_isConst; } @@ -883,8 +879,8 @@ public: , m_useType{useType} , m_name{name} {} ASTGEN_MEMBERS_CUse; - virtual void dump(std::ostream& str = std::cout) const override; - virtual string name() const override { return m_name; } + void dump(std::ostream& str = std::cout) const override; + string name() const override { return m_name; } VUseType useType() const { return m_useType; } }; class AstCaseItem final : public AstNode { @@ -899,7 +895,7 @@ public: addNOp2p(bodysp); } ASTGEN_MEMBERS_CaseItem; - virtual int instrCount() const override { return widthInstrs() + INSTR_COUNT_BRANCH; } + int instrCount() const override { return widthInstrs() + INSTR_COUNT_BRANCH; } AstNode* condsp() const { return op1p(); } // op1 = list of possible matching expressions AstNode* bodysp() const { return op2p(); } // op2 = what to do void condsp(AstNode* nodep) { setOp1p(nodep); } @@ -922,7 +918,7 @@ public: dtypeFrom(dtp); } ASTGEN_MEMBERS_Cast; - virtual bool hasDType() const override { return true; } + bool hasDType() const override { return true; } virtual string emitVerilog() { return "((%d)'(%l))"; } virtual bool cleanOut() const { V3ERROR_NA_RETURN(true); } virtual bool cleanLhs() const { return true; } @@ -930,7 +926,7 @@ public: AstNode* lhsp() const { return op1p(); } AstNode* fromp() const { return lhsp(); } void lhsp(AstNode* nodep) { setOp1p(nodep); } - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + AstNodeDType* getChildDTypep() const override { return childDTypep(); } AstNodeDType* childDTypep() const { return VN_AS(op2p(), NodeDType); } virtual AstNodeDType* subDTypep() const { return dtypep() ? dtypep() : childDTypep(); } }; @@ -996,13 +992,13 @@ public: } ASTGEN_MEMBERS_Cell; // No cloneRelink, we presume cloneee's want the same module linkages - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; const char* broken() const override; - virtual bool maybePointedTo() const override { return true; } + bool maybePointedTo() const override { return true; } // ACCESSORS - virtual string name() const override { return m_name; } // * = Cell name - virtual void name(const string& name) override { m_name = name; } - virtual string origName() const override { return m_origName; } // * = Original name + string name() const override { return m_name; } // * = Cell name + void name(const string& name) override { m_name = name; } + string origName() const override { return m_origName; } // * = Original name void origName(const string& name) { m_origName = name; } string modName() const { return m_modName; } // * = Instance name void modName(const string& name) { m_modName = name; } @@ -1038,7 +1034,7 @@ public: } ASTGEN_MEMBERS_CellArrayRef; // ACCESSORS - virtual string name() const override { return m_name; } // * = Array name + string name() const override { return m_name; } // * = Array name AstNode* selp() const { return op1p(); } // op1 = Select expression }; class AstCellInline final : public AstNode { @@ -1061,12 +1057,12 @@ public: , m_origModName{origModName} , m_timeunit{timeunit} {} ASTGEN_MEMBERS_CellInline; - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; const char* broken() const override; // ACCESSORS - virtual string name() const override { return m_name; } // * = Cell name + string name() const override { return m_name; } // * = Cell name string origModName() const { return m_origModName; } // * = modp()->origName() before inlining - virtual void name(const string& name) override { m_name = name; } + void name(const string& name) override { m_name = name; } void scopep(AstScope* scp) { m_scopep = scp; } AstScope* scopep() const { return m_scopep; } void timeunit(const VTimescale& flag) { m_timeunit = flag; } @@ -1085,7 +1081,7 @@ public: } ASTGEN_MEMBERS_CellRef; // ACCESSORS - virtual string name() const override { return m_name; } // * = Array name + string name() const override { return m_name; } // * = Array name AstNode* cellp() const { return op1p(); } // op1 = Cell AstNode* exprp() const { return op2p(); } // op2 = Expression }; @@ -1098,8 +1094,8 @@ public: setNOp2p(classOrPkgsp); // Only for parser } ASTGEN_MEMBERS_ClassExtends; - virtual bool hasDType() const override { return true; } - virtual string verilogKwd() const override { return "extends"; } + bool hasDType() const override { return true; } + string verilogKwd() const override { return "extends"; } AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } AstNode* classOrPkgsp() const { return op2p(); } @@ -1120,21 +1116,21 @@ public: } ASTGEN_MEMBERS_ClassOrPackageRef; // METHODS - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(m_classOrPackageNodep && !m_classOrPackageNodep->brokeExists()); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_classOrPackageNodep && m_classOrPackageNodep->clonep()) { m_classOrPackageNodep = m_classOrPackageNodep->clonep(); } } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { return (m_classOrPackageNodep == static_cast(samep)->m_classOrPackageNodep); } - virtual void dump(std::ostream& str = std::cout) const override; - virtual string name() const override { return m_name; } // * = Var name + void dump(std::ostream& str = std::cout) const override; + string name() const override { return m_name; } // * = Var name AstNode* classOrPackageNodep() const { return m_classOrPackageNodep; } void classOrPackageNodep(AstNode* nodep) { m_classOrPackageNodep = nodep; } AstNodeModule* classOrPackagep() const; @@ -1169,9 +1165,9 @@ class AstConstPool final : public AstNode { public: explicit AstConstPool(FileLine* fl); ASTGEN_MEMBERS_ConstPool; - virtual bool maybePointedTo() const override { return true; } + bool maybePointedTo() const override { return true; } const char* broken() const override; - virtual void cloneRelink() override { V3ERROR_NA; } + void cloneRelink() override { V3ERROR_NA; } AstModule* modp() const { return m_modp; } // Find a table (unpacked array) within the constant pool which is initialized with the @@ -1201,9 +1197,9 @@ public: , m_path{path} { setOp1p(rhsp); } - virtual string name() const override { return m_name; } // * = Scope name + string name() const override { return m_name; } // * = Scope name ASTGEN_MEMBERS_DefParam; - virtual bool same(const AstNode*) const override { return true; } + bool same(const AstNode*) const override { return true; } AstNode* rhsp() const { return op1p(); } // op1 = Assign from string path() const { return m_path; } }; @@ -1224,7 +1220,7 @@ public: if (!packageOrClassp) return rhsp; return new AstDot(fl, true, packageOrClassp, rhsp); } - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; AstNode* lhsp() const { return op1p(); } void rhsp(AstNode* nodep) { setOp2p(nodep); } AstNode* rhsp() const { return op2p(); } @@ -1243,8 +1239,8 @@ public: , m_name{vname} , m_cname{cname} {} ASTGEN_MEMBERS_DpiExport; - virtual string name() const override { return m_name; } - virtual void name(const string& name) override { m_name = name; } + string name() const override { return m_name; } + void name(const string& name) override { m_name = name; } string cname() const { return m_cname; } void cname(const string& cname) { m_cname = cname; } }; @@ -1257,24 +1253,20 @@ private: public: inline AstElabDisplay(FileLine* fl, VDisplayType dispType, AstNode* exprsp); ASTGEN_MEMBERS_ElabDisplay; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!fmtp()); return nullptr; } - virtual string verilogKwd() const override { - return (string("$") + string(displayType().ascii())); - } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { - return false; - } // SPECIAL: $display has 'visual' ordering - virtual bool isOutputter() const override { return true; } // SPECIAL: $display makes output - virtual bool isUnlikely() const override { return true; } - virtual bool same(const AstNode* samep) const override { + string verilogKwd() const override { return (string("$") + string(displayType().ascii())); } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } // SPECIAL: $display has 'visual' ordering + bool isOutputter() const override { return true; } // SPECIAL: $display makes output + bool isUnlikely() const override { return true; } + bool same(const AstNode* samep) const override { return displayType() == static_cast(samep)->displayType(); } - virtual int instrCount() const override { return INSTR_COUNT_PLI; } + int instrCount() const override { return INSTR_COUNT_PLI; } VDisplayType displayType() const { return m_displayType; } void displayType(VDisplayType type) { m_displayType = type; } void fmtp(AstSFormatF* nodep) { addOp1p((AstNode*)nodep); } // op1 = To-String formatter @@ -1286,7 +1278,7 @@ public: explicit AstEmpty(FileLine* fl) : ASTGEN_SUPER_Empty(fl) {} ASTGEN_MEMBERS_Empty; - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstExecGraph final : public AstNode { // For parallel execution, this node contains a dependency graph. Each @@ -1303,11 +1295,11 @@ public: explicit AstExecGraph(FileLine* fl, const string& name); ASTGEN_MEMBERS_ExecGraph; ~AstExecGraph() override; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!m_depGraphp); return nullptr; } - virtual string name() const override { return m_name; } + string name() const override { return m_name; } V3Graph* depGraphp() { return m_depGraphp; } const V3Graph* depGraphp() const { return m_depGraphp; } // op1: The mtask bodies @@ -1346,11 +1338,11 @@ public: addNOp1p(defaultp); } ASTGEN_MEMBERS_InitArray; - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; const char* broken() const override; void cloneRelink() override; - virtual bool hasDType() const override { return true; } - virtual bool same(const AstNode* samep) const override { + bool hasDType() const override { return true; } + bool same(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 == static_cast(samep)->m_map; @@ -1375,8 +1367,8 @@ public: addOp1p(valuep); } ASTGEN_MEMBERS_InitItem; - virtual bool maybePointedTo() const override { return true; } - virtual bool hasDType() const override { return false; } // See valuep()'s dtype instead + bool maybePointedTo() const override { return true; } + bool hasDType() const override { return false; } // See valuep()'s dtype instead AstNode* valuep() const { return op1p(); } // op1 = Value void valuep(AstNode* nodep) { addOp1p(nodep); } }; @@ -1388,7 +1380,7 @@ public: AstIntfRef(FileLine* fl, const string& name) : ASTGEN_SUPER_IntfRef(fl) , m_name{name} {} - virtual string name() const override { return m_name; } + string name() const override { return m_name; } ASTGEN_MEMBERS_IntfRef; }; class AstMTaskBody final : public AstNode { @@ -1400,7 +1392,7 @@ public: explicit AstMTaskBody(FileLine* fl) : ASTGEN_SUPER_MTaskBody(fl) {} ASTGEN_MEMBERS_MTaskBody; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!m_execMTaskp); return nullptr; } @@ -1415,7 +1407,7 @@ public: } ExecMTask* execMTaskp() const { return m_execMTaskp; } void execMTaskp(ExecMTask* execMTaskp) { m_execMTaskp = execMTaskp; } - virtual void dump(std::ostream& str = std::cout) const override; + void dump(std::ostream& str = std::cout) const override; }; class AstModport final : public AstNode { // A modport in an interface @@ -1427,8 +1419,8 @@ public: , m_name{name} { addNOp1p(varsp); } - virtual string name() const override { return m_name; } - virtual bool maybePointedTo() const override { return true; } + string name() const override { return m_name; } + bool maybePointedTo() const override { return true; } ASTGEN_MEMBERS_Modport; AstNode* varsp() const { return op1p(); } // op1 = List of Vars }; @@ -1449,8 +1441,8 @@ public: ASTGEN_MEMBERS_ModportFTaskRef; const char* broken() const override; void cloneRelink() override; - virtual void dump(std::ostream& str) const override; - virtual string name() const override { return m_name; } + void dump(std::ostream& str) const override; + string name() const override { return m_name; } bool isImport() const { return !m_export; } bool isExport() const { return m_export; } AstNodeFTask* ftaskp() const { return m_ftaskp; } // [After Link] Pointer to variable @@ -1472,8 +1464,8 @@ public: ASTGEN_MEMBERS_ModportVarRef; const char* broken() const override; void cloneRelink() override; - virtual void dump(std::ostream& str) const override; - virtual string name() const override { return m_name; } + void dump(std::ostream& str) const override; + string name() const override { return m_name; } void direction(const VDirection& flag) { m_direction = flag; } VDirection direction() const { return m_direction; } AstVar* varp() const { return m_varp; } // [After Link] Pointer to variable @@ -1501,9 +1493,9 @@ public: AstNetlist(); ASTGEN_MEMBERS_Netlist; const char* broken() const override; - virtual void cloneRelink() override { V3ERROR_NA; } - virtual string name() const override { return "$root"; } - virtual void dump(std::ostream& str) const override; + void cloneRelink() override { V3ERROR_NA; } + string name() const override { return "$root"; } + void dump(std::ostream& str) const override; AstNodeModule* modulesp() const { // op1 = List of modules return VN_AS(op1p(), NodeModule); } @@ -1553,8 +1545,8 @@ public: ASTGEN_MEMBERS_PackageExport; const char* broken() const override; void cloneRelink() override; - virtual void dump(std::ostream& str) const override; - virtual string name() const override { return m_name; } + void dump(std::ostream& str) const override; + string name() const override { return m_name; } AstPackage* packagep() const { return m_packagep; } void packagep(AstPackage* nodep) { m_packagep = nodep; } }; @@ -1579,8 +1571,8 @@ public: ASTGEN_MEMBERS_PackageImport; const char* broken() const override; void cloneRelink() override; - virtual void dump(std::ostream& str) const override; - virtual string name() const override { return m_name; } + void dump(std::ostream& str) const override; + string name() const override { return m_name; } AstPackage* packagep() const { return m_packagep; } void packagep(AstPackage* nodep) { m_packagep = nodep; } }; @@ -1604,13 +1596,13 @@ public: setNOp2p((AstNode*)ftaskrefp); } ASTGEN_MEMBERS_ParseRef; - virtual void dump(std::ostream& str) const override; - virtual string name() const override { return m_name; } // * = Var name - virtual bool same(const AstNode* samep) const override { + void dump(std::ostream& str) const override; + string name() const override { return m_name; } // * = Var name + bool same(const AstNode* samep) const override { const AstParseRef* const asamep = static_cast(samep); return (expect() == asamep->expect() && m_name == asamep->m_name); } - virtual void name(const string& name) override { m_name = name; } + void name(const string& name) override { m_name = name; } VParseRefExp expect() const { return m_expect; } void expect(VParseRefExp exp) { m_expect = exp; } // op1 = Components @@ -1637,10 +1629,10 @@ public: } inline AstPin(FileLine* fl, int pinNum, AstVarRef* varname, AstNode* exprp); ASTGEN_MEMBERS_Pin; - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; const char* broken() const override; - virtual string name() const override { return m_name; } // * = Pin name, ""=go by number - virtual void name(const string& name) override { m_name = name; } + string name() const override { return m_name; } // * = Pin name, ""=go by number + void name(const string& name) override { m_name = name; } string prettyOperatorName() const override; bool dotStar() const { return name() == ".*"; } // Fake name for .* connections until linked int pinNum() const { return m_pinNum; } @@ -1668,7 +1660,7 @@ public: , m_pinNum{pinnum} , m_name{name} {} ASTGEN_MEMBERS_Port; - virtual string name() const override { return m_name; } // * = Port name + string name() const override { return m_name; } // * = Port name int pinNum() const { return m_pinNum; } // * = Pin number, for order based instantiation AstNode* exprp() const { return op1p(); } // op1 = Expression connected to port }; @@ -1683,8 +1675,8 @@ public: , m_pragType{pragType} {} ASTGEN_MEMBERS_Pragma; VPragmaType pragType() const { return m_pragType; } // *=type of the pragma - virtual bool isPredictOptimizable() const override { return false; } - virtual bool same(const AstNode* samep) const override { + bool isPredictOptimizable() const override { return false; } + bool same(const AstNode* samep) const override { return pragType() == static_cast(samep)->pragType(); } }; @@ -1700,7 +1692,7 @@ public: addOp3p(propp); } ASTGEN_MEMBERS_PropClocked; - virtual bool hasDType() const override { + bool hasDType() const override { return true; } // Used under Cover, which expects a bool child AstSenItem* sensesp() const { return VN_AS(op1p(), SenItem); } // op1 = Sensitivity list @@ -1718,7 +1710,7 @@ public: setOp1p(lhsp); } ASTGEN_MEMBERS_Pull; - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { return direction() == static_cast(samep)->direction(); } void lhsp(AstNode* np) { setOp1p(np); } @@ -1758,13 +1750,13 @@ public: addNOp2p(nullptr); } ASTGEN_MEMBERS_SFormatF; - virtual string name() const override { return m_text; } - virtual int instrCount() const override { return INSTR_COUNT_PLI; } - virtual bool hasDType() const override { return true; } - virtual bool same(const AstNode* samep) const override { + string name() const override { return m_text; } + int instrCount() const override { return INSTR_COUNT_PLI; } + bool hasDType() const override { return true; } + bool same(const AstNode* samep) const override { return text() == static_cast(samep)->text(); } - virtual string verilogKwd() const override { return "$sformatf"; } + string verilogKwd() const override { return "$sformatf"; } void addExprsp(AstNode* nodep) { addOp1p(nodep); } // op1 = Expressions to output AstNode* exprsp() const { return op1p(); } // op1 = Expressions to output string text() const { return m_text; } // * = Text to display @@ -1800,12 +1792,12 @@ public: , m_aboveCellp{aboveCellp} , m_modp{modp} {} ASTGEN_MEMBERS_Scope; - virtual void cloneRelink() override; - virtual const char* broken() const override; - virtual bool maybePointedTo() const override { return true; } - virtual string name() const override { return m_name; } // * = Scope name - virtual void name(const string& name) override { m_name = name; } - virtual void dump(std::ostream& str) const override; + void cloneRelink() override; + const char* broken() const override; + bool maybePointedTo() const override { return true; } + string name() const override { return m_name; } // * = Scope name + void name(const string& name) override { m_name = name; } + void dump(std::ostream& str) const override; string nameDotless() const; string nameVlSym() const { return ((string("vlSymsp->")) + nameDotless()); } AstNodeModule* modp() const { return m_modp; } @@ -1829,8 +1821,8 @@ public: addNOp2p(elementsp); } ASTGEN_MEMBERS_SelLoopVars; - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual bool maybePointedTo() const override { return false; } + bool same(const AstNode* /*samep*/) const override { return true; } + bool maybePointedTo() const override { return false; } AstNode* fromp() const { return op1p(); } void fromp(AstNode* nodep) { setOp1p(nodep); } AstNode* elementsp() const { return op2p(); } @@ -1867,8 +1859,8 @@ public: : ASTGEN_SUPER_SenItem(fl) , m_edgeType{VEdgeType::ET_NEVER} {} ASTGEN_MEMBERS_SenItem; - virtual void dump(std::ostream& str) const override; - virtual bool same(const AstNode* samep) const override { + void dump(std::ostream& str) const override; + bool same(const AstNode* samep) const override { return edgeType() == static_cast(samep)->edgeType(); } VEdgeType edgeType() const { return m_edgeType; } // * = Posedge/negedge @@ -1901,8 +1893,8 @@ public: addNOp1p(sensesp); } ASTGEN_MEMBERS_SenTree; - virtual void dump(std::ostream& str) const override; - virtual bool maybePointedTo() const override { return true; } + void dump(std::ostream& str) const override; + bool maybePointedTo() const override { return true; } bool isMulti() const { return m_multi; } // op1 = Sensitivity list AstSenItem* sensesp() const { return VN_AS(op1p(), SenItem); } @@ -1935,7 +1927,7 @@ public: ASTGEN_MEMBERS_StrengthSpec; VStrength strength0() { return m_s0; } VStrength strength1() { return m_s1; } - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; }; class AstTopScope final : public AstNode { // A singleton, held under the top level AstModule. Holds the top level AstScope, @@ -1950,7 +1942,7 @@ class AstTopScope final : public AstNode { public: ASTGEN_MEMBERS_TopScope; - virtual bool maybePointedTo() const override { return true; } + bool maybePointedTo() const override { return true; } AstSenTree* senTreesp() const { return VN_AS(op1p(), SenTree); } void addSenTreep(AstSenTree* nodep) { addOp1p((AstNode*)nodep); } AstScope* scopep() const { return VN_AS(op2p(), Scope); } @@ -1969,14 +1961,14 @@ class AstTypeTable final : public AstNode { public: explicit AstTypeTable(FileLine* fl); ASTGEN_MEMBERS_TypeTable; - virtual bool maybePointedTo() const override { return true; } - virtual const char* broken() const override { + bool maybePointedTo() const override { return true; } + const char* broken() const override { BROKEN_RTN(m_emptyQueuep && !m_emptyQueuep->brokeExists()); BROKEN_RTN(m_queueIndexp && !m_queueIndexp->brokeExists()); BROKEN_RTN(m_voidp && !m_voidp->brokeExists()); return nullptr; } - virtual void cloneRelink() override { V3ERROR_NA; } + void cloneRelink() override { V3ERROR_NA; } AstNodeDType* typesp() const { return VN_AS(op1p(), NodeDType); } // op1 = List of dtypes void addTypesp(AstNodeDType* nodep) { addOp1p(nodep); } AstBasicDType* findBasicDType(FileLine* fl, VBasicDTypeKwd kwd); @@ -1990,7 +1982,7 @@ public: AstVoidDType* findVoidDType(FileLine* fl); void clearCache(); void repairCache(); - virtual void dump(std::ostream& str = std::cout) const override; + void dump(std::ostream& str = std::cout) const override; }; class AstTypedef final : public AstNode { private: @@ -2007,8 +1999,8 @@ public: dtypep(nullptr); // V3Width will resolve } ASTGEN_MEMBERS_Typedef; - virtual void dump(std::ostream& str) const override; - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + void dump(std::ostream& str) const override; + AstNodeDType* getChildDTypep() const override { return childDTypep(); } // op1 = Type assigning to AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } void childDTypep(AstNodeDType* nodep) { setOp1p(nodep); } @@ -2016,14 +2008,14 @@ public: void addAttrsp(AstNode* nodep) { addNOp4p(nodep); } AstNode* attrsp() const { return op4p(); } // op4 = Attributes during early parse // METHODS - virtual string name() const override { return m_name; } - virtual bool maybePointedTo() const override { return true; } - virtual bool hasDType() const override { return true; } - virtual void name(const string& flag) override { m_name = flag; } + string name() const override { return m_name; } + bool maybePointedTo() const override { return true; } + bool hasDType() const override { return true; } + void name(const string& flag) override { m_name = flag; } bool attrPublic() const { return m_attrPublic; } void attrPublic(bool flag) { m_attrPublic = flag; } - virtual void tag(const string& text) override { m_tag = text; } - virtual string tag() const override { return m_tag; } + void tag(const string& text) override { m_tag = text; } + string tag() const override { return m_tag; } }; class AstTypedefFwd final : public AstNode { // Forward declaration of a type; stripped after netlist parsing is complete @@ -2036,8 +2028,8 @@ public: , m_name{name} {} ASTGEN_MEMBERS_TypedefFwd; // METHODS - virtual string name() const override { return m_name; } - virtual bool maybePointedTo() const override { return true; } + string name() const override { return m_name; } + bool maybePointedTo() const override { return true; } }; class AstUdpTable final : public AstNode { public: @@ -2057,7 +2049,7 @@ public: : ASTGEN_SUPER_UdpTableLine(fl) , m_text{text} {} ASTGEN_MEMBERS_UdpTableLine; - virtual string name() const override { return m_text; } + string name() const override { return m_text; } string text() const { return m_text; } }; class AstUnlinkedRef final : public AstNode { @@ -2073,7 +2065,7 @@ public: } ASTGEN_MEMBERS_UnlinkedRef; // ACCESSORS - virtual string name() const override { return m_name; } // * = Var name + string name() const override { return m_name; } // * = Var name AstNode* refp() const { return op1p(); } // op1 = VarXRef or AstNodeFTaskRef AstNode* cellrefp() const { return op2p(); } // op2 = CellArrayRef or CellRef }; @@ -2232,11 +2224,11 @@ public: m_declKwd = examplep->declKwd(); } ASTGEN_MEMBERS_Var; - virtual void dump(std::ostream& str) const override; - virtual string name() const override { return m_name; } // * = Var name - virtual bool hasDType() const override { return true; } - virtual bool maybePointedTo() const override { return true; } - virtual string origName() const override { return m_origName; } // * = Original name + void dump(std::ostream& str) const override; + string name() const override { return m_name; } // * = Var name + bool hasDType() const override { return true; } + bool maybePointedTo() const override { return true; } + string origName() const override { return m_origName; } // * = Original name void origName(const string& name) { m_origName = name; } VVarType varType() const { return m_varType; } // * = Type of variable void direction(const VDirection& flag) { @@ -2269,7 +2261,7 @@ public: string vlEnumDir() const; // Return VerilatorVarDir: VLVD_INOUT, etc string vlPropDecl(const string& propName) const; // Return VerilatorVarProps declaration void combineType(VVarType type); - virtual AstNodeDType* getChildDTypep() const override { return childDTypep(); } + AstNodeDType* getChildDTypep() const override { return childDTypep(); } // op1 = Range of variable AstNodeDType* childDTypep() const { return VN_AS(op1p(), NodeDType); } // op2 = Net delay @@ -2340,9 +2332,9 @@ public: bool isForceable() const { return m_isForceable; } void setForceable() { m_isForceable = true; } // METHODS - virtual void name(const string& name) override { m_name = name; } - virtual void tag(const string& text) override { m_tag = text; } - virtual string tag() const override { return m_tag; } + void name(const string& name) override { m_name = name; } + void tag(const string& text) override { m_tag = text; } + string tag() const override { return m_tag; } bool isAnsi() const { return m_ansi; } bool isContinuously() const { return m_isContinuously; } bool isDeclTyped() const { return m_declTyped; } @@ -2406,7 +2398,7 @@ public: bool attrSplitVar() const { return m_attrSplitVar; } bool attrIsolateAssign() const { return m_attrIsolateAssign; } VVarAttrClocker attrClocker() const { return m_attrClocker; } - virtual string verilogKwd() const override; + string verilogKwd() const override; void lifetime(const VLifetime& flag) { m_lifetime = flag; } VLifetime lifetime() const { return m_lifetime; } void propagateAttrFrom(AstVar* fromp) { @@ -2469,22 +2461,22 @@ public: dtypeFrom(varp); } ASTGEN_MEMBERS_VarScope; - virtual void cloneRelink() override { + void cloneRelink() override { if (m_varp && m_varp->clonep()) { m_varp = m_varp->clonep(); UASSERT(m_scopep->clonep(), "No clone cross link: " << this); m_scopep = m_scopep->clonep(); } } - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(m_varp && !m_varp->brokeExists()); BROKEN_RTN(m_scopep && !m_scopep->brokeExists()); return nullptr; } - virtual bool maybePointedTo() const override { return true; } - virtual string name() const override { return scopep()->name() + "->" + varp()->name(); } - virtual void dump(std::ostream& str) const override; - virtual bool hasDType() const override { return true; } + bool maybePointedTo() const override { return true; } + string name() const override { return scopep()->name() + "->" + varp()->name(); } + void dump(std::ostream& str) const override; + bool hasDType() const override { return true; } AstVar* varp() const { return m_varp; } // [After Link] Pointer to variable AstScope* scopep() const { return m_scopep; } // Pointer to scope it's under void scopep(AstScope* nodep) { m_scopep = nodep; } @@ -2510,7 +2502,7 @@ public: , m_generate{generate} , m_implied{implied} {} ASTGEN_MEMBERS_Begin; - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; // op1p is statements in NodeBlock AstNode* genforp() const { return op2p(); } // op2 = GENFOR, if applicable, // might NOT be a GenFor, as loop unrolling replaces with Begin @@ -2530,7 +2522,7 @@ public: AstFork(FileLine* fl, const string& name, AstNode* stmtsp) : ASTGEN_SUPER_Fork(fl, name, stmtsp) {} ASTGEN_MEMBERS_Fork; - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; VJoinType joinType() const { return m_joinType; } void joinType(const VJoinType& flag) { m_joinType = flag; } }; @@ -2544,7 +2536,7 @@ public: addNOp1p(fvarsp); } ASTGEN_MEMBERS_Func; - virtual bool hasDType() const override { return true; } + bool hasDType() const override { return true; } }; class AstTask final : public AstNodeFTask { // A task inside a module @@ -2569,7 +2561,7 @@ public: , m_source{false} , m_support{false} {} ASTGEN_MEMBERS_CFile; - virtual void dump(std::ostream& str = std::cout) const override; + void dump(std::ostream& str = std::cout) const override; bool slow() const { return m_slow; } void slow(bool flag) { m_slow = flag; } bool source() const { return m_source; } @@ -2584,7 +2576,7 @@ public: AstVFile(FileLine* fl, const string& name) : ASTGEN_SUPER_VFile(fl, name) {} ASTGEN_MEMBERS_VFile; - virtual void dump(std::ostream& str = std::cout) const override; + void dump(std::ostream& str = std::cout) const override; }; // === AstNodeModule === @@ -2602,12 +2594,12 @@ public: AstClass(FileLine* fl, const string& name) : ASTGEN_SUPER_Class(fl, name) {} ASTGEN_MEMBERS_Class; - virtual string verilogKwd() const override { return "class"; } - virtual bool maybePointedTo() const override { return true; } - virtual void dump(std::ostream& str) const override; + string verilogKwd() const override { return "class"; } + bool maybePointedTo() const override { return true; } + void dump(std::ostream& str) const override; const char* broken() const override; void cloneRelink() override; - virtual bool timescaleMatters() const override { return false; } + bool timescaleMatters() const override { return false; } // op1/op2/op3 in AstNodeModule AstClassPackage* classOrPackagep() const { return m_classOrPackagep; } void classOrPackagep(AstClassPackage* classpackagep) { m_classOrPackagep = classpackagep; } @@ -2640,10 +2632,10 @@ public: AstClassPackage(FileLine* fl, const string& name) : ASTGEN_SUPER_ClassPackage(fl, name) {} ASTGEN_MEMBERS_ClassPackage; - virtual string verilogKwd() const override { return "classpackage"; } - virtual const char* broken() const override; - virtual void cloneRelink() override; - virtual bool timescaleMatters() const override { return false; } + string verilogKwd() const override { return "classpackage"; } + const char* broken() const override; + void cloneRelink() override; + bool timescaleMatters() const override { return false; } AstClass* classp() const { return m_classp; } void classp(AstClass* classp) { m_classp = classp; } }; @@ -2655,8 +2647,8 @@ public: ASTGEN_MEMBERS_Iface; // Interfaces have `timescale applicability but lots of code seems to // get false warnings if we enable this - virtual string verilogKwd() const override { return "interface"; } - virtual bool timescaleMatters() const override { return false; } + string verilogKwd() const override { return "interface"; } + bool timescaleMatters() const override { return false; } }; class AstModule final : public AstNodeModule { // A module declaration @@ -2667,8 +2659,8 @@ public: : ASTGEN_SUPER_Module(fl, name) , m_isProgram{program} {} ASTGEN_MEMBERS_Module; - virtual string verilogKwd() const override { return m_isProgram ? "program" : "module"; } - virtual bool timescaleMatters() const override { return true; } + string verilogKwd() const override { return m_isProgram ? "program" : "module"; } + bool timescaleMatters() const override { return true; } }; class AstNotFoundModule final : public AstNodeModule { // A missing module declaration @@ -2676,8 +2668,8 @@ public: AstNotFoundModule(FileLine* fl, const string& name) : ASTGEN_SUPER_NotFoundModule(fl, name) {} ASTGEN_MEMBERS_NotFoundModule; - virtual string verilogKwd() const override { return "/*not-found-*/ module"; } - virtual bool timescaleMatters() const override { return false; } + string verilogKwd() const override { return "/*not-found-*/ module"; } + bool timescaleMatters() const override { return false; } }; class AstPackage final : public AstNodeModule { // A package declaration @@ -2685,8 +2677,8 @@ public: AstPackage(FileLine* fl, const string& name) : ASTGEN_SUPER_Package(fl, name) {} ASTGEN_MEMBERS_Package; - virtual string verilogKwd() const override { return "package"; } - virtual bool timescaleMatters() const override { return !isDollarUnit(); } + string verilogKwd() const override { return "package"; } + bool timescaleMatters() const override { return !isDollarUnit(); } static string dollarUnitName() { return AstNode::encodeName("$unit"); } bool isDollarUnit() const { return name() == dollarUnitName(); } }; @@ -2696,8 +2688,8 @@ public: AstPrimitive(FileLine* fl, const string& name) : ASTGEN_SUPER_Primitive(fl, name) {} ASTGEN_MEMBERS_Primitive; - virtual string verilogKwd() const override { return "primitive"; } - virtual bool timescaleMatters() const override { return false; } + string verilogKwd() const override { return "primitive"; } + bool timescaleMatters() const override { return false; } }; // === AstNodePreSel === @@ -2755,7 +2747,7 @@ public: } ASTGEN_MEMBERS_Always; // - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; AstSenTree* sensesp() const { return VN_AS(op1p(), SenTree); } // op1 = Sensitivity list void sensesp(AstSenTree* nodep) { setOp1p(nodep); } VAlwaysKwd keyword() const { return m_keyword; } @@ -2818,10 +2810,10 @@ public: ASTGEN_MEMBERS_BracketRange; virtual string emitC() { V3ERROR_NA_RETURN(""); } virtual string emitVerilog() { V3ERROR_NA_RETURN(""); } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } // Will be removed in V3Width, which relies on this // being a child not a dtype pointed node - virtual bool maybePointedTo() const override { return false; } + bool maybePointedTo() const override { return false; } AstNode* elementsp() const { return op1p(); } }; class AstRange final : public AstNodeRange { @@ -2851,9 +2843,9 @@ public: } int elementsConst() const { return hiConst() - loConst() + 1; } bool littleEndian() const { return leftConst() < rightConst(); } - virtual void dump(std::ostream& str) const override; + void dump(std::ostream& str) const override; virtual string emitC() { V3ERROR_NA_RETURN(""); } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstUnsizedRange final : public AstNodeRange { // Unsized range specification, for open arrays @@ -2863,7 +2855,7 @@ public: ASTGEN_MEMBERS_UnsizedRange; virtual string emitC() { V3ERROR_NA_RETURN(""); } virtual string emitVerilog() { return "[]"; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstWildcardRange final : public AstNodeRange { // Wildcard range specification, for wildcard index type associative arrays @@ -2873,7 +2865,7 @@ public: ASTGEN_MEMBERS_WildcardRange; virtual string emitC() { V3ERROR_NA_RETURN(""); } virtual string emitVerilog() { return "[*]"; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; // === AstNodeStmt === @@ -2887,7 +2879,7 @@ public: addNOp2p(bodysp); } ASTGEN_MEMBERS_AlwaysPublic; - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } // AstSenTree* sensesp() const { return VN_AS(op1p(), SenTree); } // op1 = Sensitivity list AstNode* bodysp() const { return op2p(); } // op2 = Statements to evaluate @@ -2901,8 +2893,8 @@ public: explicit AstBreak(FileLine* fl) : ASTGEN_SUPER_Break(fl) {} ASTGEN_MEMBERS_Break; - virtual string verilogKwd() const override { return "break"; } - virtual bool isBrancher() const override { + string verilogKwd() const override { return "break"; } + bool isBrancher() const override { return true; // SPECIAL: We don't process code after breaks } }; @@ -2929,14 +2921,14 @@ public: addNOp2p(pinsp); } ASTGEN_MEMBERS_CMethodHard; - virtual string name() const override { return m_name; } // * = Var name - virtual bool hasDType() const override { return true; } - virtual void name(const string& name) override { m_name = name; } - virtual bool same(const AstNode* samep) const override { + string name() const override { return m_name; } // * = Var name + bool hasDType() const override { return true; } + void name(const string& name) override { m_name = name; } + bool same(const AstNode* samep) const override { const AstCMethodHard* asamep = static_cast(samep); return (m_name == asamep->m_name); } - virtual bool isPure() const override { return m_pure; } + bool isPure() const override { return m_pure; } void pure(bool flag) { m_pure = flag; } void makeStatement() { statement(true); @@ -2957,9 +2949,9 @@ public: addNOp1p((AstNode*)exprsp); } ASTGEN_MEMBERS_CReset; - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool same(const AstNode* /*samep*/) const override { return true; } AstVarRef* varrefp() const { return VN_AS(op1p(), VarRef); } // op1 = varref to reset }; class AstCReturn final : public AstNodeStmt { @@ -2972,8 +2964,8 @@ public: setOp1p(lhsp); } ASTGEN_MEMBERS_CReturn; - virtual int instrCount() const override { return widthInstrs(); } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + int instrCount() const override { return widthInstrs(); } + bool same(const AstNode* /*samep*/) const override { return true; } // AstNode* lhsp() const { return op1p(); } }; @@ -2986,9 +2978,9 @@ public: } inline AstCStmt(FileLine* fl, const string& textStmt); ASTGEN_MEMBERS_CStmt; - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool same(const AstNode* /*samep*/) const override { return true; } void addBodysp(AstNode* nodep) { addNOp1p(nodep); } AstNode* bodysp() const { return op1p(); } // op1 = expressions to print }; @@ -3004,10 +2996,10 @@ public: ASTGEN_MEMBERS_ChangeDet; AstNode* lhsp() const { return op1p(); } AstNode* rhsp() const { return op2p(); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual int instrCount() const override { return widthInstrs() * 2; } // xor, or/logor - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + int instrCount() const override { return widthInstrs() * 2; } // xor, or/logor + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstComment final : public AstNodeStmt { // Some comment to put into the output stream @@ -3022,10 +3014,8 @@ public: , m_showAt{showAt} , m_name{name} {} ASTGEN_MEMBERS_Comment; - virtual string name() const override { return m_name; } // * = Text - virtual bool same(const AstNode* samep) const override { - return true; - } // Ignore name in comments + string name() const override { return m_name; } // * = Text + bool same(const AstNode* samep) const override { return true; } // Ignore name in comments virtual bool showAt() const { return m_showAt; } }; class AstContinue final : public AstNodeStmt { @@ -3033,8 +3023,8 @@ public: explicit AstContinue(FileLine* fl) : ASTGEN_SUPER_Continue(fl) {} ASTGEN_MEMBERS_Continue; - virtual string verilogKwd() const override { return "continue"; } - virtual bool isBrancher() const override { + string verilogKwd() const override { return "continue"; } + bool isBrancher() const override { return true; // SPECIAL: We don't process code after breaks } }; @@ -3060,19 +3050,19 @@ public: , m_linescov{linescov} , m_offset{offset} {} ASTGEN_MEMBERS_CoverDecl; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(m_dataDeclp && !m_dataDeclp->brokeExists()); if (m_dataDeclp && m_dataDeclp->m_dataDeclp) { // Avoid O(n^2) accessing v3fatalSrc("dataDeclp should point to real data, not be a list"); } return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_dataDeclp && m_dataDeclp->clonep()) m_dataDeclp = m_dataDeclp->clonep(); } - virtual void dump(std::ostream& str) const override; - virtual int instrCount() const override { return 1 + 2 * INSTR_COUNT_LD; } - virtual bool maybePointedTo() const override { return true; } + void dump(std::ostream& str) const override; + int instrCount() const override { return 1 + 2 * INSTR_COUNT_LD; } + bool maybePointedTo() const override { return true; } void binNum(int flag) { m_binNum = flag; } int binNum() const { return m_binNum; } int offset() const { return m_offset; } @@ -3082,12 +3072,12 @@ public: const string& hier() const { return m_hier; } void hier(const string& flag) { m_hier = flag; } void comment(const string& flag) { m_text = flag; } - virtual bool same(const AstNode* samep) const override { + bool same(const AstNode* samep) const override { const AstCoverDecl* const asamep = static_cast(samep); return (fileline() == asamep->fileline() && linescov() == asamep->linescov() && hier() == asamep->hier() && comment() == asamep->comment()); } - virtual bool isPredictOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } void dataDeclp(AstCoverDecl* nodep) { m_dataDeclp = nodep; } // dataDecl nullptr means "use this one", but often you want "this" to // indicate to get data from here @@ -3105,21 +3095,21 @@ public: : ASTGEN_SUPER_CoverInc(fl) , m_declp{declp} {} ASTGEN_MEMBERS_CoverInc; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!declp()->brokeExists()); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_declp->clonep()) m_declp = m_declp->clonep(); } - virtual void dump(std::ostream& str) const override; - virtual int instrCount() const override { return 1 + 2 * INSTR_COUNT_LD; } - virtual bool same(const AstNode* samep) const override { + void dump(std::ostream& str) const override; + int instrCount() const override { return 1 + 2 * INSTR_COUNT_LD; } + bool same(const AstNode* samep) const override { return declp() == static_cast(samep)->declp(); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isOutputter() const override { return true; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isOutputter() const override { return true; } // but isPure() true AstCoverDecl* declp() const { return m_declp; } // Where defined }; @@ -3135,11 +3125,11 @@ public: setOp3p(changep); } ASTGEN_MEMBERS_CoverToggle; - virtual int instrCount() const override { return 3 + INSTR_COUNT_BRANCH + INSTR_COUNT_LD; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return true; } - virtual bool isOutputter() const override { + int instrCount() const override { return 3 + INSTR_COUNT_BRANCH + INSTR_COUNT_LD; } + bool same(const AstNode* /*samep*/) const override { return true; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return true; } + bool isOutputter() const override { return false; // Though the AstCoverInc under this is an outputter } // but isPure() true @@ -3157,7 +3147,7 @@ public: setNOp2p(stmtsp); } ASTGEN_MEMBERS_Delay; - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } // AstNode* lhsp() const { return op1p(); } // op1 = delay value void lhsp(AstNode* nodep) { setOp1p(nodep); } @@ -3172,9 +3162,9 @@ public: : ASTGEN_SUPER_Disable(fl) , m_name{name} {} ASTGEN_MEMBERS_Disable; - virtual string name() const override { return m_name; } // * = Block name - virtual void name(const string& flag) override { m_name = flag; } - virtual bool isBrancher() const override { + string name() const override { return m_name; } // * = Block name + void name(const string& flag) override { m_name = flag; } + bool isBrancher() const override { return true; // SPECIAL: We don't process code after breaks } }; @@ -3208,26 +3198,24 @@ public: setNOp3p(filep); } ASTGEN_MEMBERS_Display; - virtual void dump(std::ostream& str) const override; - virtual const char* broken() const override { + void dump(std::ostream& str) const override; + const char* broken() const override { BROKEN_RTN(!fmtp()); return nullptr; } - virtual string verilogKwd() const override { + string verilogKwd() const override { return (filep() ? string("$f") + string(displayType().ascii()) : string("$") + string(displayType().ascii())); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { - return false; - } // SPECIAL: $display has 'visual' ordering - virtual bool isOutputter() const override { return true; } // SPECIAL: $display makes output - virtual bool isUnlikely() const override { return true; } - virtual bool same(const AstNode* samep) const override { + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } // SPECIAL: $display has 'visual' ordering + bool isOutputter() const override { return true; } // SPECIAL: $display makes output + bool isUnlikely() const override { return true; } + bool same(const AstNode* samep) const override { return displayType() == static_cast(samep)->displayType(); } - virtual int instrCount() const override { return INSTR_COUNT_PLI; } + int instrCount() const override { return INSTR_COUNT_PLI; } VDisplayType displayType() const { return m_displayType; } void displayType(VDisplayType type) { m_displayType = type; } // * = Add a newline for $display @@ -3256,12 +3244,12 @@ public: setNOp1p(exprp); } ASTGEN_MEMBERS_DumpCtl; - virtual string verilogKwd() const override { return ctlType().ascii(); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isOutputter() const override { return true; } + string verilogKwd() const override { return ctlType().ascii(); } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isOutputter() const override { return true; } virtual bool cleanOut() const { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } VDumpCtlType ctlType() const { return m_ctlType; } AstNode* exprp() const { return op1p(); } // op2 = Expressions to output void exprp(AstNode* nodep) { setOp1p(nodep); } @@ -3275,12 +3263,12 @@ public: setNOp2p(stmtsp); } ASTGEN_MEMBERS_EventControl; - virtual string verilogKwd() const override { return "@(%l) %r"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return false; } - virtual int instrCount() const override { return 0; } + string verilogKwd() const override { return "@(%l) %r"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return false; } + int instrCount() const override { return 0; } AstSenTree* sensesp() const { return VN_AS(op1p(), SenTree); } AstNode* stmtsp() const { return op2p(); } }; @@ -3293,13 +3281,13 @@ public: setNOp2p(filep); } ASTGEN_MEMBERS_FClose; - virtual string verilogKwd() const override { return "$fclose"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual bool isUnlikely() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$fclose"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + bool isUnlikely() const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* filep() const { return op2p(); } void filep(AstNodeVarRef* nodep) { setNOp2p((AstNode*)nodep); } }; @@ -3312,13 +3300,13 @@ public: setNOp2p(filep); } ASTGEN_MEMBERS_FFlush; - virtual string verilogKwd() const override { return "$fflush"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual bool isUnlikely() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$fflush"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + bool isUnlikely() const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* filep() const { return op2p(); } void filep(AstNodeVarRef* nodep) { setNOp2p((AstNode*)nodep); } }; @@ -3332,13 +3320,13 @@ public: setOp3p(modep); } ASTGEN_MEMBERS_FOpen; - virtual string verilogKwd() const override { return "$fopen"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual bool isUnlikely() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$fopen"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + bool isUnlikely() const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* filep() const { return op1p(); } AstNode* filenamep() const { return op2p(); } AstNode* modep() const { return op3p(); } @@ -3352,13 +3340,13 @@ public: setOp2p(filenamep); } ASTGEN_MEMBERS_FOpenMcd; - virtual string verilogKwd() const override { return "$fopen"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual bool isUnlikely() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$fopen"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + bool isUnlikely() const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* filep() const { return op1p(); } AstNode* filenamep() const { return op2p(); } }; @@ -3367,17 +3355,13 @@ public: explicit AstFinish(FileLine* fl) : ASTGEN_SUPER_Finish(fl) {} ASTGEN_MEMBERS_Finish; - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { - return false; - } // SPECIAL: $display has 'visual' ordering - virtual bool isOutputter() const override { return true; } // SPECIAL: $display makes output - virtual bool isUnlikely() const override { return true; } - virtual int instrCount() const override { return 0; } // Rarely executes - virtual bool same(const AstNode* samep) const override { - return fileline() == samep->fileline(); - } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } // SPECIAL: $display has 'visual' ordering + bool isOutputter() const 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(); } }; class AstForeach final : public AstNodeStmt { public: @@ -3389,9 +3373,9 @@ public: ASTGEN_MEMBERS_Foreach; AstNode* arrayp() const { return op1p(); } // op1 = array and index vars AstNode* bodysp() const { return op4p(); } // op4 = body of loop - virtual bool isGateOptimizable() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool isGateOptimizable() const override { return false; } + int instrCount() const override { return INSTR_COUNT_BRANCH; } + bool same(const AstNode* /*samep*/) const override { return true; } bool isFirstInMyListOfStatements(AstNode* n) const override { return n == bodysp(); } }; class AstJumpBlock final : public AstNodeStmt { @@ -3407,12 +3391,12 @@ public: : ASTGEN_SUPER_JumpBlock(fl) { addNOp1p(stmtsp); } - virtual const char* broken() const override; - virtual void cloneRelink() override; + const char* broken() const override; + void cloneRelink() override; ASTGEN_MEMBERS_JumpBlock; - virtual int instrCount() const override { return 0; } - virtual bool maybePointedTo() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + int instrCount() const override { return 0; } + bool maybePointedTo() const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } // op1 = Statements AstNode* stmtsp() const { return op1p(); } // op1 = List of statements void addStmtsp(AstNode* nodep) { addNOp1p(nodep); } @@ -3437,13 +3421,13 @@ public: ASTGEN_MEMBERS_JumpGo; const char* broken() const override; void cloneRelink() override; - virtual void dump(std::ostream& str) const override; - virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } - virtual bool same(const AstNode* samep) const override { + void dump(std::ostream& str) const override; + int instrCount() const override { return INSTR_COUNT_BRANCH; } + bool same(const AstNode* samep) const override { return labelp() == static_cast(samep)->labelp(); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isBrancher() const override { + bool isGateOptimizable() const override { return false; } + bool isBrancher() const override { return true; // SPECIAL: We don't process code after breaks } AstJumpLabel* labelp() const { return m_labelp; } @@ -3459,18 +3443,18 @@ public: : ASTGEN_SUPER_JumpLabel(fl) , m_blockp{blockp} {} ASTGEN_MEMBERS_JumpLabel; - virtual bool maybePointedTo() const override { return true; } - virtual const char* broken() const override { + bool maybePointedTo() const override { return true; } + const char* broken() const override { BROKEN_RTN(!blockp()->brokeExistsAbove()); BROKEN_RTN(blockp()->labelp() != this); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_blockp->clonep()) m_blockp = m_blockp->clonep(); } - virtual void dump(std::ostream& str) const override; - virtual int instrCount() const override { return 0; } - virtual bool same(const AstNode* samep) const override { + void dump(std::ostream& str) const override; + int instrCount() const override { return 0; } + bool same(const AstNode* samep) const override { return blockp() == static_cast(samep)->blockp(); } AstJumpBlock* blockp() const { return m_blockp; } @@ -3483,15 +3467,13 @@ public: : ASTGEN_SUPER_MonitorOff(fl) , m_off{off} {} ASTGEN_MEMBERS_MonitorOff; - virtual string verilogKwd() const override { return m_off ? "$monitoroff" : "$monitoron"; } - virtual bool isGateOptimizable() const override { return false; } // Though deleted before opt - virtual bool isPredictOptimizable() const override { - return false; - } // Though deleted before opt - virtual bool isPure() const override { return false; } // Though deleted before opt - virtual bool isOutputter() const override { return true; } // Though deleted before opt - virtual int instrCount() const override { return INSTR_COUNT_PLI; } - virtual bool same(const AstNode* samep) const override { + string verilogKwd() const override { return m_off ? "$monitoroff" : "$monitoron"; } + bool isGateOptimizable() const override { return false; } // Though deleted before opt + bool isPredictOptimizable() const override { return false; } // Though deleted before opt + bool isPure() const override { return false; } // Though deleted before opt + bool isOutputter() const override { return true; } // Though deleted before opt + int instrCount() const override { return INSTR_COUNT_PLI; } + bool same(const AstNode* samep) const override { return m_off == static_cast(samep)->m_off; } bool off() const { return m_off; } @@ -3504,15 +3486,15 @@ public: explicit AstPrintTimeScale(FileLine* fl) : ASTGEN_SUPER_PrintTimeScale(fl) {} ASTGEN_MEMBERS_PrintTimeScale; - virtual void name(const string& name) override { m_name = name; } - virtual string name() const override { return m_name; } // * = Var name - virtual void dump(std::ostream& str) const override; - virtual string verilogKwd() const override { return "$printtimescale"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual int instrCount() const override { return INSTR_COUNT_PLI; } + void name(const string& name) override { m_name = name; } + string name() const override { return m_name; } // * = Var name + void dump(std::ostream& str) const override; + string verilogKwd() const override { return "$printtimescale"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + int instrCount() const override { return INSTR_COUNT_PLI; } void timeunit(const VTimescale& flag) { m_timeunit = flag; } VTimescale timeunit() const { return m_timeunit; } }; @@ -3536,11 +3518,9 @@ public: ASTGEN_MEMBERS_Repeat; AstNode* countp() const { return op2p(); } // op2 = condition to continue AstNode* bodysp() const { return op3p(); } // op3 = body of loop - virtual bool isGateOptimizable() const override { - return false; - } // Not relevant - converted to FOR - virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + 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 isFirstInMyListOfStatements(AstNode* n) const override { return n == bodysp(); } }; class AstReturn final : public AstNodeStmt { @@ -3550,9 +3530,9 @@ public: setNOp1p(lhsp); } ASTGEN_MEMBERS_Return; - virtual string verilogKwd() const override { return "return"; } + string verilogKwd() const override { return "return"; } AstNode* lhsp() const { return op1p(); } - virtual bool isBrancher() const override { + bool isBrancher() const override { return true; // SPECIAL: We don't process code after breaks } }; @@ -3573,18 +3553,18 @@ public: setOp3p(lhsp); } ASTGEN_MEMBERS_SFormat; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!fmtp()); return nullptr; } - virtual string verilogKwd() const override { return "$sformat"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return true; } - virtual bool isPure() const override { return true; } - virtual bool isOutputter() const override { return false; } + string verilogKwd() const override { return "$sformat"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return true; } + bool isPure() const override { return true; } + bool isOutputter() const override { return false; } virtual bool cleanOut() const { return false; } - virtual int instrCount() const override { return INSTR_COUNT_PLI; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + int instrCount() const override { return INSTR_COUNT_PLI; } + bool same(const AstNode* /*samep*/) const override { return true; } void fmtp(AstSFormatF* nodep) { addOp1p(nodep); } // op1 = To-String formatter AstSFormatF* fmtp() const { return VN_AS(op1p(), SFormatF); } AstNode* lhsp() const { return op3p(); } @@ -3595,17 +3575,13 @@ public: AstStop(FileLine* fl, bool maybe) : ASTGEN_SUPER_Stop(fl) {} ASTGEN_MEMBERS_Stop; - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { - return false; - } // SPECIAL: $display has 'visual' ordering - virtual bool isOutputter() const override { return true; } // SPECIAL: $display makes output - virtual bool isUnlikely() const override { return true; } - virtual int instrCount() const override { return 0; } // Rarely executes - virtual bool same(const AstNode* samep) const override { - return fileline() == samep->fileline(); - } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } // SPECIAL: $display has 'visual' ordering + bool isOutputter() const 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(); } }; class AstSysFuncAsTask final : public AstNodeStmt { // Call what is normally a system function (with a return) in a non-return context @@ -3617,13 +3593,13 @@ public: addNOp1p(exprsp); } ASTGEN_MEMBERS_SysFuncAsTask; - virtual string verilogKwd() const override { return ""; } - virtual bool isGateOptimizable() const override { return true; } - virtual bool isPredictOptimizable() const override { return true; } - virtual bool isPure() const override { return true; } - virtual bool isOutputter() const override { return false; } - virtual int instrCount() const override { return 0; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return ""; } + bool isGateOptimizable() const override { return true; } + bool isPredictOptimizable() const override { return true; } + bool isPure() const override { return true; } + bool isOutputter() const override { return false; } + int instrCount() const override { return 0; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* lhsp() const { return op1p(); } // op1 = Expressions to eval void lhsp(AstNode* nodep) { addOp1p(nodep); } // op1 = Expressions to eval }; @@ -3636,14 +3612,12 @@ public: addNOp1p(exprsp); } ASTGEN_MEMBERS_SysIgnore; - virtual string verilogKwd() const override { return "$ignored"; } - virtual bool isGateOptimizable() const override { return false; } // Though deleted before opt - virtual bool isPredictOptimizable() const override { - return false; - } // Though deleted before opt - virtual bool isPure() const override { return false; } // Though deleted before opt - virtual bool isOutputter() const override { return true; } // Though deleted before opt - virtual int instrCount() const override { return INSTR_COUNT_PLI; } + string verilogKwd() const override { return "$ignored"; } + bool isGateOptimizable() const override { return false; } // Though deleted before opt + bool isPredictOptimizable() const override { return false; } // Though deleted before opt + bool isPure() const override { return false; } // Though deleted before opt + bool isOutputter() const override { return true; } // Though deleted before opt + int instrCount() const override { return INSTR_COUNT_PLI; } AstNode* exprsp() const { return op1p(); } // op1 = Expressions to output void exprsp(AstNode* nodep) { addOp1p(nodep); } // op1 = Expressions to output }; @@ -3655,13 +3629,13 @@ public: setOp1p(lhsp); } ASTGEN_MEMBERS_SystemT; - virtual string verilogKwd() const override { return "$system"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual bool isUnlikely() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + string verilogKwd() const override { return "$system"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + bool isUnlikely() const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } AstNode* lhsp() const { return op1p(); } }; class AstTimeFormat final : public AstNodeStmt { @@ -3676,12 +3650,12 @@ public: setOp4p(widthp); } ASTGEN_MEMBERS_TimeFormat; - virtual string verilogKwd() const override { return "$timeformat"; } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual int instrCount() const override { return INSTR_COUNT_PLI; } + string verilogKwd() const override { return "$timeformat"; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + int instrCount() const override { return INSTR_COUNT_PLI; } AstNode* unitsp() const { return op1p(); } AstNode* precisionp() const { return op2p(); } AstNode* suffixp() const { return op3p(); } @@ -3718,13 +3692,13 @@ public: dtypeFrom(valuep); addNOp1p(valuep); } - virtual void dump(std::ostream& str) const override; - virtual int instrCount() const override { return 100; } // Large... + void dump(std::ostream& str) const override; + int instrCount() const override { return 100; } // Large... ASTGEN_MEMBERS_TraceDecl; - virtual string name() const override { return m_showname; } - virtual bool maybePointedTo() const override { return true; } - virtual bool hasDType() const override { return true; } - virtual bool same(const AstNode* samep) const override { return false; } + string name() const override { return m_showname; } + bool maybePointedTo() const override { return true; } + bool hasDType() const override { return true; } + bool same(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; } @@ -3758,22 +3732,22 @@ public: addOp2p(declp->valuep()->cloneTree(true)); } ASTGEN_MEMBERS_TraceInc; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_RTN(!declp()->brokeExists()); return nullptr; } - virtual void cloneRelink() override { + void cloneRelink() override { if (m_declp->clonep()) m_declp = m_declp->clonep(); } - virtual void dump(std::ostream& str) const override; - virtual int instrCount() const override { return 10 + 2 * INSTR_COUNT_LD; } - virtual bool hasDType() const override { return true; } - virtual bool same(const AstNode* samep) const override { + void dump(std::ostream& str) const override; + int instrCount() const override { return 10 + 2 * INSTR_COUNT_LD; } + bool hasDType() const override { return true; } + bool same(const AstNode* samep) const override { return declp() == static_cast(samep)->declp(); } - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isOutputter() const override { return true; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isOutputter() const override { return true; } // but isPure() true // op1 = Statements before the value AstNode* precondsp() const { return op1p(); } @@ -3790,7 +3764,7 @@ public: : ASTGEN_SUPER_TracePopNamePrefix(fl) , m_count{count} {} ASTGEN_MEMBERS_TracePopNamePrefix; - virtual bool same(const AstNode* samep) const override { return false; } + bool same(const AstNode* samep) const override { return false; } unsigned count() const { return m_count; } }; class AstTracePushNamePrefix final : public AstNodeStmt { @@ -3800,7 +3774,7 @@ public: : ASTGEN_SUPER_TracePushNamePrefix(fl) , m_prefix{prefix} {} ASTGEN_MEMBERS_TracePushNamePrefix; - virtual bool same(const AstNode* samep) const override { return false; } + bool same(const AstNode* samep) const override { return false; } string prefix() const { return m_prefix; } }; class AstUCStmt final : public AstNodeStmt { @@ -3812,11 +3786,11 @@ public: } ASTGEN_MEMBERS_UCStmt; AstNode* bodysp() const { return op1p(); } // op1 = expressions to print - virtual bool isGateOptimizable() const override { return false; } - virtual bool isPredictOptimizable() const override { return false; } - virtual bool isPure() const override { return false; } - virtual bool isOutputter() const override { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool isGateOptimizable() const override { return false; } + bool isPredictOptimizable() const override { return false; } + bool isPure() const override { return false; } + bool isOutputter() const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } }; class AstWait final : public AstNodeStmt { public: @@ -3853,13 +3827,13 @@ public: void addPrecondsp(AstNode* newp) { addOp1p(newp); } void addBodysp(AstNode* newp) { addOp3p(newp); } void addIncsp(AstNode* newp) { addOp4p(newp); } - virtual bool isGateOptimizable() const override { return false; } - virtual int instrCount() const override { return INSTR_COUNT_BRANCH; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool isGateOptimizable() const override { return false; } + int instrCount() const override { return INSTR_COUNT_BRANCH; } + bool same(const AstNode* /*samep*/) const override { return true; } // Stop statement searchback here - virtual void addBeforeStmt(AstNode* newp, AstNode* belowp) override; + void addBeforeStmt(AstNode* newp, AstNode* belowp) override; // Stop statement searchback here - virtual void addNextStmt(AstNode* newp, AstNode* belowp) override; + void addNextStmt(AstNode* newp, AstNode* belowp) override; bool isFirstInMyListOfStatements(AstNode* n) const override { return n == bodysp(); } }; class AstWith final : public AstNodeStmt { @@ -3878,9 +3852,9 @@ public: addNOp3p(exprp); } ASTGEN_MEMBERS_With; - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual bool hasDType() const override { return true; } - virtual const char* broken() const override { + bool same(const AstNode* /*samep*/) const override { return true; } + bool hasDType() 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 return nullptr; @@ -3903,7 +3877,7 @@ public: addNOp2p(exprp); } ASTGEN_MEMBERS_WithParse; - virtual bool same(const AstNode* /*samep*/) const override { return true; } + bool same(const AstNode* /*samep*/) const override { return true; } // AstNode* funcrefp() const { return op1p(); } AstNode* exprp() const { return op2p(); } @@ -3917,10 +3891,10 @@ public: dtypeFrom(lhsp); } ASTGEN_MEMBERS_Assign; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAssign(this->fileline(), lhsp, rhsp); } - virtual bool brokeLhsMustBeLvalue() const override { return true; } + bool brokeLhsMustBeLvalue() const override { return true; } }; class AstAssignAlias final : public AstNodeAssign { // Like AstAssignW, but a true bidirect interconnection alias @@ -3929,22 +3903,20 @@ public: AstAssignAlias(FileLine* fl, AstVarRef* lhsp, AstVarRef* rhsp) : ASTGEN_SUPER_AssignAlias(fl, (AstNode*)lhsp, (AstNode*)rhsp) {} ASTGEN_MEMBERS_AssignAlias; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { - V3ERROR_NA_RETURN(nullptr); - } - virtual bool brokeLhsMustBeLvalue() const override { return false; } + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { V3ERROR_NA_RETURN(nullptr); } + bool brokeLhsMustBeLvalue() const override { return false; } }; class AstAssignDly final : public AstNodeAssign { public: AstAssignDly(FileLine* fl, AstNode* lhsp, AstNode* rhsp, AstNode* timingControlp = nullptr) : ASTGEN_SUPER_AssignDly(fl, lhsp, rhsp, timingControlp) {} ASTGEN_MEMBERS_AssignDly; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAssignDly(this->fileline(), lhsp, rhsp); } - virtual bool isGateOptimizable() const override { return false; } - virtual string verilogKwd() const override { return "<="; } - virtual bool brokeLhsMustBeLvalue() const override { return true; } + bool isGateOptimizable() const override { return false; } + string verilogKwd() const override { return "<="; } + bool brokeLhsMustBeLvalue() const override { return true; } }; class AstAssignForce final : public AstNodeAssign { // Procedural 'force' statement @@ -3952,10 +3924,10 @@ public: AstAssignForce(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : ASTGEN_SUPER_AssignForce(fl, lhsp, rhsp) {} ASTGEN_MEMBERS_AssignForce; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAssignForce{this->fileline(), lhsp, rhsp}; } - virtual bool brokeLhsMustBeLvalue() const override { return true; } + bool brokeLhsMustBeLvalue() const override { return true; } }; class AstAssignPost final : public AstNodeAssign { // Like Assign, but predelayed assignment requiring special order handling @@ -3963,10 +3935,10 @@ public: AstAssignPost(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : ASTGEN_SUPER_AssignPost(fl, lhsp, rhsp) {} ASTGEN_MEMBERS_AssignPost; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAssignPost(this->fileline(), lhsp, rhsp); } - virtual bool brokeLhsMustBeLvalue() const override { return true; } + bool brokeLhsMustBeLvalue() const override { return true; } }; class AstAssignPre final : public AstNodeAssign { // Like Assign, but predelayed assignment requiring special order handling @@ -3974,10 +3946,10 @@ public: AstAssignPre(FileLine* fl, AstNode* lhsp, AstNode* rhsp) : ASTGEN_SUPER_AssignPre(fl, lhsp, rhsp) {} ASTGEN_MEMBERS_AssignPre; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAssignPre(this->fileline(), lhsp, rhsp); } - virtual bool brokeLhsMustBeLvalue() const override { return true; } + bool brokeLhsMustBeLvalue() const override { return true; } }; class AstAssignVarScope final : public AstNodeAssign { // Assign two VarScopes to each other @@ -3987,10 +3959,10 @@ public: dtypeFrom(rhsp); } ASTGEN_MEMBERS_AssignVarScope; - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAssignVarScope(this->fileline(), lhsp, rhsp); } - virtual bool brokeLhsMustBeLvalue() const override { return false; } + bool brokeLhsMustBeLvalue() const override { return false; } }; class AstAssignW final : public AstNodeAssign { // Like assign, but wire/assign's in verilog, the only setting of the specified variable @@ -4000,10 +3972,10 @@ public: ASTGEN_MEMBERS_AssignW; AstStrengthSpec* strengthSpecp() const { return VN_AS(op4p(), StrengthSpec); } void strengthSpecp(AstStrengthSpec* const strengthSpecp) { setOp4p((AstNode*)strengthSpecp); } - virtual AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { + AstNode* cloneType(AstNode* lhsp, AstNode* rhsp) override { return new AstAssignW(this->fileline(), lhsp, rhsp); } - virtual bool brokeLhsMustBeLvalue() const override { return true; } + bool brokeLhsMustBeLvalue() const override { return true; } AstAlways* convertToAlways() { AstNode* const lhs1p = lhsp()->unlinkFrBack(); AstNode* const rhs1p = rhsp()->unlinkFrBack(); @@ -4041,7 +4013,7 @@ public: setOp1p(fromp); } ASTGEN_MEMBERS_CMethodCall; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_BASE_RTN(AstNodeCCall::broken()); BROKEN_RTN(!fromp()); return nullptr; @@ -4060,7 +4032,7 @@ public: : ASTGEN_SUPER_CNew(fl, funcp, argsp) { statement(false); } - virtual bool hasDType() const override { return true; } + bool hasDType() const override { return true; } ASTGEN_MEMBERS_CNew; }; @@ -4082,10 +4054,8 @@ public: : ASTGEN_SUPER_Case(fl, exprp, casesp) , m_casex{casex} {} ASTGEN_MEMBERS_Case; - virtual string verilogKwd() const override { - return casez() ? "casez" : casex() ? "casex" : "case"; - } - virtual bool same(const AstNode* samep) const override { + string verilogKwd() const override { return casez() ? "casez" : casex() ? "casex" : "case"; } + bool same(const AstNode* samep) const override { return m_casex == static_cast(samep)->m_casex; } bool casex() const { return m_casex == VCaseType::CT_CASEX; } @@ -4163,7 +4133,7 @@ public: AstFuncRef(FileLine* fl, const string& name, AstNode* pinsp) : ASTGEN_SUPER_FuncRef(fl, false, name, pinsp) {} ASTGEN_MEMBERS_FuncRef; - virtual bool hasDType() const override { return true; } + bool hasDType() const override { return true; } }; class AstMethodCall final : public AstNodeFTaskRef { // A reference to a member task (or function) @@ -4182,13 +4152,13 @@ public: setOp2p(fromp); } ASTGEN_MEMBERS_MethodCall; - virtual const char* broken() const override { + const char* broken() const override { BROKEN_BASE_RTN(AstNodeFTaskRef::broken()); BROKEN_RTN(!fromp()); return nullptr; } - virtual void dump(std::ostream& str) const override; - virtual bool hasDType() const override { return true; } + void dump(std::ostream& str) const override; + bool hasDType() const override { return true; } void makeStatement() { statement(true); dtypeSetVoid(); @@ -4208,9 +4178,9 @@ public: : ASTGEN_SUPER_New(fl, false, "new", pinsp) {} ASTGEN_MEMBERS_New; virtual bool cleanOut() const { return true; } - virtual bool same(const AstNode* /*samep*/) const override { return true; } - virtual bool hasDType() const override { return true; } - virtual int instrCount() const override { return widthInstrs(); } + bool same(const AstNode* /*samep*/) const override { return true; } + bool hasDType() const override { return true; } + int instrCount() const override { return widthInstrs(); } }; class AstTaskRef final : public AstNodeFTaskRef { // A reference to a task @@ -4263,8 +4233,8 @@ public: AstNode* msbp) : ASTGEN_SUPER_ReadMem(fl, hex, filenamep, memp, lsbp, msbp) {} ASTGEN_MEMBERS_ReadMem; - virtual string verilogKwd() const override { return (isHex() ? "$readmemh" : "$readmemb"); } - virtual const char* cFuncPrefixp() const override { return "VL_READMEM_"; } + string verilogKwd() const override { return (isHex() ? "$readmemh" : "$readmemb"); } + const char* cFuncPrefixp() const override { return "VL_READMEM_"; } }; class AstWriteMem final : public AstNodeReadWriteMem { public: @@ -4272,8 +4242,8 @@ public: AstNode* msbp) : ASTGEN_SUPER_WriteMem(fl, hex, filenamep, memp, lsbp, msbp) {} ASTGEN_MEMBERS_WriteMem; - virtual string verilogKwd() const override { return (isHex() ? "$writememh" : "$writememb"); } - virtual const char* cFuncPrefixp() const override { return "VL_WRITEMEM_"; } + string verilogKwd() const override { return (isHex() ? "$writememh" : "$writememb"); } + const char* cFuncPrefixp() const override { return "VL_WRITEMEM_"; } }; // === AstNodeText === @@ -4282,48 +4252,48 @@ public: AstScCtor(FileLine* fl, const string& textp) : ASTGEN_SUPER_ScCtor(fl, textp) {} ASTGEN_MEMBERS_ScCtor; - virtual bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs - virtual bool isOutputter() const override { return true; } + bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs + bool isOutputter() const override { return true; } }; class AstScDtor final : public AstNodeText { public: AstScDtor(FileLine* fl, const string& textp) : ASTGEN_SUPER_ScDtor(fl, textp) {} ASTGEN_MEMBERS_ScDtor; - virtual bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs - virtual bool isOutputter() const override { return true; } + bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs + bool isOutputter() const override { return true; } }; class AstScHdr final : public AstNodeText { public: AstScHdr(FileLine* fl, const string& textp) : ASTGEN_SUPER_ScHdr(fl, textp) {} ASTGEN_MEMBERS_ScHdr; - virtual bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs - virtual bool isOutputter() const override { return true; } + bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs + bool isOutputter() const override { return true; } }; class AstScImp final : public AstNodeText { public: AstScImp(FileLine* fl, const string& textp) : ASTGEN_SUPER_ScImp(fl, textp) {} ASTGEN_MEMBERS_ScImp; - virtual bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs - virtual bool isOutputter() const override { return true; } + bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs + bool isOutputter() const override { return true; } }; class AstScImpHdr final : public AstNodeText { public: AstScImpHdr(FileLine* fl, const string& textp) : ASTGEN_SUPER_ScImpHdr(fl, textp) {} ASTGEN_MEMBERS_ScImpHdr; - virtual bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs - virtual bool isOutputter() const override { return true; } + bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs + bool isOutputter() const override { return true; } }; class AstScInt final : public AstNodeText { public: AstScInt(FileLine* fl, const string& textp) : ASTGEN_SUPER_ScInt(fl, textp) {} ASTGEN_MEMBERS_ScInt; - virtual bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs - virtual bool isOutputter() const override { return true; } + bool isPure() const override { return false; } // SPECIAL: User may order w/other sigs + bool isOutputter() const override { return true; } }; // === AstNodeSimpleText === diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 4dd3d6e77..d891a46c4 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -564,11 +564,11 @@ string AstVar::dpiArgType(bool named, bool forReturn) const { return dpiTypesToStringConverter{}.convert(this); } else { class converter final : public dpiTypesToStringConverter { - virtual string bitLogicVector(const AstVar* varp, bool isBit) const override { + string bitLogicVector(const AstVar* varp, bool isBit) const override { return string(varp->isReadOnly() ? "const " : "") + dpiTypesToStringConverter::bitLogicVector(varp, isBit) + '*'; } - virtual string primitive(const AstVar* varp) const override { + string primitive(const AstVar* varp) const override { string type = dpiTypesToStringConverter::primitive(varp); if (varp->isWritable() || VN_IS(varp->dtypep()->skipRefp(), UnpackArrayDType)) { if (!varp->isWritable() && varp->basicp()->keyword() != VBasicDTypeKwd::STRING) @@ -600,16 +600,16 @@ string AstVar::dpiTmpVarType(const string& varName) const { return ""; } } - virtual string openArray(const AstVar* varp) const override { + string openArray(const AstVar* varp) const override { return dpiTypesToStringConverter::openArray(varp) + ' ' + m_name + arraySuffix(varp, 0); } - virtual string bitLogicVector(const AstVar* varp, bool isBit) const override { + string bitLogicVector(const AstVar* varp, bool isBit) const override { string type = dpiTypesToStringConverter::bitLogicVector(varp, isBit); type += ' ' + m_name + arraySuffix(varp, varp->widthWords()); return type; } - virtual string primitive(const AstVar* varp) const override { + string primitive(const AstVar* varp) const override { string type = dpiTypesToStringConverter::primitive(varp); if (varp->isWritable() || VN_IS(varp->dtypep()->skipRefp(), UnpackArrayDType)) { if (!varp->isWritable() && varp->basicp()->keyword() == VBasicDTypeKwd::CHANDLE) diff --git a/src/V3Begin.cpp b/src/V3Begin.cpp index 6a40e1233..9f65dd79a 100644 --- a/src/V3Begin.cpp +++ b/src/V3Begin.cpp @@ -120,14 +120,14 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); { m_modp = nodep; iterateChildren(nodep); } } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { UINFO(8, " " << nodep << endl); // Rename it if (m_unnamedScope != "") { @@ -162,7 +162,7 @@ private: m_ftaskp = nullptr; } } - virtual void visit(AstBegin* nodep) override { + void visit(AstBegin* nodep) override { // Begin blocks were only useful in variable creation, change names and delete UINFO(8, " " << nodep << endl); VL_RESTORER(m_displayScope); @@ -191,7 +191,7 @@ private: VL_DO_DANGLING(pushDeletep(nodep), nodep); } } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { if (m_unnamedScope != "") { // Rename it nodep->name(dot(m_unnamedScope, nodep->name())); @@ -200,7 +200,7 @@ private: liftNode(nodep); } } - virtual void visit(AstTypedef* nodep) override { + void visit(AstTypedef* nodep) override { if (m_unnamedScope != "") { // Rename it nodep->name(dot(m_unnamedScope, nodep->name())); @@ -209,7 +209,7 @@ private: liftNode(nodep); } } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { UINFO(8, " CELL " << nodep << endl); if (m_namedScope != "") { m_statep->userMarkChanged(nodep); @@ -222,14 +222,14 @@ private: } iterateChildren(nodep); } - virtual void visit(AstVarXRef* nodep) override { + void visit(AstVarXRef* nodep) override { UINFO(9, " VARXREF " << nodep << endl); if (m_namedScope != "" && nodep->inlinedDots() == "" && !m_ftaskp) { nodep->inlinedDots(m_namedScope); UINFO(9, " rescope to " << nodep << endl); } } - virtual void visit(AstScopeName* nodep) override { + void visit(AstScopeName* nodep) override { // If there's a %m in the display text, we add a special node that will contain the name() // Similar code in V3Inline if (nodep->user1SetOnce()) return; // Don't double-add text's @@ -244,13 +244,13 @@ private: } iterateChildren(nodep); } - virtual void visit(AstCoverDecl* nodep) override { + void visit(AstCoverDecl* nodep) override { // Don't need to fix path in coverage statements, they're not under // any BEGINs, but V3Coverage adds them all under the module itself. iterateChildren(nodep); } // VISITORS - LINT CHECK - virtual void visit(AstIf* nodep) override { // not AstNodeIf; other types not covered + void visit(AstIf* nodep) override { // not AstNodeIf; other types not covered // Check IFDEPTH warning - could be in other transform files if desire VL_RESTORER(m_ifDepth); if (m_ifDepth == -1 || v3Global.opt.ifDepth() < 1) { // Turned off @@ -264,7 +264,7 @@ private: } iterateChildren(nodep); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -272,7 +272,7 @@ public: : m_statep{statep} { iterate(nodep); } - virtual ~BeginVisitor() override = default; + ~BeginVisitor() override = default; }; //###################################################################### @@ -285,21 +285,21 @@ private: // AstNodeFTask::user1p // Node replaced, rename it // VISITORS - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { if (nodep->taskp()->user1()) { // It was converted UINFO(9, " relinkFTask " << nodep << endl); nodep->name(nodep->taskp()->name()); } iterateChildren(nodep); } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (nodep->varp()->user1()) { // It was converted UINFO(9, " relinVarRef " << nodep << endl); nodep->name(nodep->varp()->name()); } iterateChildren(nodep); } - virtual void visit(AstIfaceRefDType* nodep) override { + void visit(AstIfaceRefDType* nodep) override { // May have changed cell names // TypeTable is always after all modules, so names are stable UINFO(8, " IFACEREFDTYPE " << nodep << endl); @@ -308,12 +308,12 @@ private: iterateChildren(nodep); } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS BeginRelinkVisitor(AstNetlist* nodep, BeginState*) { iterate(nodep); } - virtual ~BeginRelinkVisitor() override = default; + ~BeginRelinkVisitor() override = default; }; //###################################################################### diff --git a/src/V3Branch.cpp b/src/V3Branch.cpp index 51c749eb4..eed4e49fc 100644 --- a/src/V3Branch.cpp +++ b/src/V3Branch.cpp @@ -63,7 +63,7 @@ private: } // VISITORS - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { UINFO(4, " IF: " << nodep << endl); VL_RESTORER(m_likely); VL_RESTORER(m_unlikely); @@ -87,17 +87,17 @@ private: } // else leave unknown } } - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { checkUnlikely(nodep); nodep->funcp()->user1Inc(); iterateChildren(nodep); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { checkUnlikely(nodep); m_cfuncsp.push_back(nodep); iterateChildren(nodep); } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { checkUnlikely(nodep); iterateChildren(nodep); } @@ -116,7 +116,7 @@ public: iterateChildren(nodep); calc_tasks(); } - virtual ~BranchVisitor() override = default; + ~BranchVisitor() override = default; }; //###################################################################### diff --git a/src/V3Broken.cpp b/src/V3Broken.cpp index 6f1f906e8..75fb8c356 100644 --- a/src/V3Broken.cpp +++ b/src/V3Broken.cpp @@ -214,27 +214,27 @@ private: } return false; } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { processAndIterate(nodep); UASSERT_OBJ(!(v3Global.assertDTypesResolved() && nodep->brokeLhsMustBeLvalue() && VN_IS(nodep->lhsp(), NodeVarRef) && !VN_AS(nodep->lhsp(), NodeVarRef)->access().isWriteOrRW()), nodep, "Assignment LHS is not an lvalue"); } - virtual void visit(AstRelease* nodep) override { + void visit(AstRelease* nodep) override { processAndIterate(nodep); UASSERT_OBJ(!(v3Global.assertDTypesResolved() && VN_IS(nodep->lhsp(), NodeVarRef) && !VN_AS(nodep->lhsp(), NodeVarRef)->access().isWriteOrRW()), nodep, "Release LHS is not an lvalue"); } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { VL_RESTORER(m_inScope); { m_inScope = true; processAndIterate(nodep); } } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { processAndIterate(nodep); // m_inScope because some Vars have initial variable references without scopes // This might false fire with some debug flags, as not certain we don't have temporary @@ -252,7 +252,7 @@ private: } } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { UASSERT_OBJ(!m_cfuncp, nodep, "Nested AstCFunc"); m_cfuncp = nodep; m_localVars.clear(); @@ -270,7 +270,7 @@ private: m_cfuncp = nullptr; } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { // Each branch is a separate local variable scope pushLocalScope(); processEnter(nodep); @@ -288,21 +288,21 @@ private: processExit(nodep); popLocalScope(); } - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { // For local variable checking act as if any statement introduces a new scope. // This is aggressive but conservatively correct. pushLocalScope(); processAndIterate(nodep); popLocalScope(); } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { processAndIterate(nodep); if (m_cfuncp) { m_localVars.insert(nodep); m_localsStack.back().insert(nodep); } } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { // Process not just iterate processAndIterate(nodep); } @@ -310,7 +310,7 @@ private: public: // CONSTRUCTORS explicit BrokenCheckVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~BrokenCheckVisitor() override = default; + ~BrokenCheckVisitor() override = default; }; //###################################################################### diff --git a/src/V3CUse.cpp b/src/V3CUse.cpp index 2d301567e..5bf6bfe69 100644 --- a/src/V3CUse.cpp +++ b/src/V3CUse.cpp @@ -57,7 +57,7 @@ class CUseVisitor final : public VNVisitor { } // VISITORS - virtual void visit(AstClassRefDType* nodep) override { + void visit(AstClassRefDType* nodep) override { if (nodep->user1SetOnce()) return; // Process once if (!m_impOnly) addNewUse(nodep, VUseType::INT_FWD_CLASS, nodep->classp()->name()); // Need to include extends() when we implement, but no need for pointers to know @@ -67,17 +67,17 @@ class CUseVisitor final : public VNVisitor { iterateChildren(nodep->classp()); // This also gets all extend classes } } - virtual void visit(AstNodeDType* nodep) override { + void visit(AstNodeDType* nodep) override { if (nodep->user1SetOnce()) return; // Process once if (nodep->virtRefDTypep()) iterate(nodep->virtRefDTypep()); if (nodep->virtRefDType2p()) iterate(nodep->virtRefDType2p()); } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { if (nodep->user1SetOnce()) return; // Process once if (nodep->dtypep() && !nodep->dtypep()->user1()) iterate(nodep->dtypep()); iterateChildren(nodep); } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { if (nodep->user1SetOnce()) return; // Process once // Currently no IMP_INCLUDE because we include __Syms which has them all addNewUse(nodep, VUseType::INT_FWD_CLASS, nodep->modp()->name()); @@ -90,7 +90,7 @@ public: : m_modp(modp) { iterate(modp); } - virtual ~CUseVisitor() override = default; + ~CUseVisitor() override = default; VL_UNCOPYABLE(CUseVisitor); }; diff --git a/src/V3Case.cpp b/src/V3Case.cpp index c8a2e639f..58a160301 100644 --- a/src/V3Case.cpp +++ b/src/V3Case.cpp @@ -59,7 +59,7 @@ private: // METHODS VL_DEBUG_FUNC; // Declare debug() - virtual void visit(AstNodeCase* nodep) override { + void visit(AstNodeCase* nodep) override { if (VN_IS(nodep, Case) && VN_AS(nodep, Case)->casex()) { nodep->v3warn(CASEX, "Suggest casez (with ?'s) in place of casex (with X's)"); } @@ -86,7 +86,7 @@ private: m_caseExprp = nullptr; } } - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { // See also neverItem if (m_caseExprp && nodep->num().isFourState()) { if (VN_IS(m_caseExprp, GenCase)) { @@ -107,12 +107,12 @@ private: } } } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit CaseLintVisitor(AstNodeCase* nodep) { iterate(nodep); } - virtual ~CaseLintVisitor() override = default; + ~CaseLintVisitor() override = default; }; //###################################################################### @@ -493,7 +493,7 @@ private: } // VISITORS - virtual void visit(AstCase* nodep) override { + void visit(AstCase* nodep) override { V3Case::caseLint(nodep); iterateChildren(nodep); if (debug() >= 9) nodep->dumpTree(cout, " case_old: "); @@ -510,7 +510,7 @@ private: } } //-------------------- - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { if (VN_IS(nodep, Always)) m_alwaysp = nodep; iterateChildren(nodep); } @@ -521,7 +521,7 @@ public: for (auto& itr : m_valueItem) itr = nullptr; iterate(nodep); } - virtual ~CaseVisitor() override { + ~CaseVisitor() override { V3Stats::addStat("Optimizations, Cases parallelized", m_statCaseFast); V3Stats::addStat("Optimizations, Cases complex", m_statCaseSlow); } diff --git a/src/V3Cast.cpp b/src/V3Cast.cpp index fa5b748e9..5d39416bf 100644 --- a/src/V3Cast.cpp +++ b/src/V3Cast.cpp @@ -111,25 +111,25 @@ private: } // VISITORS - virtual void visit(AstNodeUniop* nodep) override { + void visit(AstNodeUniop* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1()); if (nodep->sizeMattersLhs()) ensureCast(nodep->lhsp()); } - virtual void visit(AstNodeBiop* nodep) override { + void visit(AstNodeBiop* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1() | nodep->rhsp()->user1()); if (nodep->sizeMattersLhs()) ensureCast(nodep->lhsp()); if (nodep->sizeMattersRhs()) ensureCast(nodep->rhsp()); } - virtual void visit(AstNodeTriop* nodep) override { + void visit(AstNodeTriop* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1() | nodep->rhsp()->user1() | nodep->thsp()->user1()); if (nodep->sizeMattersLhs()) ensureCast(nodep->lhsp()); if (nodep->sizeMattersRhs()) ensureCast(nodep->rhsp()); if (nodep->sizeMattersThs()) ensureCast(nodep->thsp()); } - virtual void visit(AstNodeQuadop* nodep) override { + void visit(AstNodeQuadop* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1() | nodep->rhsp()->user1() | nodep->thsp()->user1() | nodep->fhsp()->user1()); @@ -138,12 +138,12 @@ private: if (nodep->sizeMattersThs()) ensureCast(nodep->thsp()); if (nodep->sizeMattersFhs()) ensureCast(nodep->fhsp()); } - virtual void visit(AstCCast* nodep) override { + void visit(AstCCast* nodep) override { iterateChildren(nodep); ensureLower32Cast(nodep); nodep->user1(1); } - virtual void visit(AstNegate* nodep) override { + void visit(AstNegate* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1()); if (nodep->lhsp()->widthMin() == 1) { @@ -155,7 +155,7 @@ private: ensureCast(nodep->lhsp()); } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { const AstNode* const backp = nodep->backp(); if (nodep->access().isReadOnly() && !VN_IS(backp, CCast) && VN_IS(backp, NodeMath) && !VN_IS(backp, ArraySel) && !VN_IS(backp, RedXor) && backp->width() @@ -166,7 +166,7 @@ private: } nodep->user1(1); } - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { // Constants are of unknown size if smaller than 33 bits, because // we're too lazy to wrap every constant in the universe in // ((IData)#). @@ -174,29 +174,29 @@ private: } // Null dereference protection - virtual void visit(AstNullCheck* nodep) override { + void visit(AstNullCheck* nodep) override { iterateChildren(nodep); nodep->user1(nodep->lhsp()->user1()); } - virtual void visit(AstCMethodCall* nodep) override { + void visit(AstCMethodCall* nodep) override { iterateChildren(nodep); ensureNullChecked(nodep->fromp()); } - virtual void visit(AstMemberSel* nodep) override { + void visit(AstMemberSel* nodep) override { iterateChildren(nodep); ensureNullChecked(nodep->fromp()); } // NOPs - virtual void visit(AstVar*) override {} + void visit(AstVar*) override {} //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit CastVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~CastVisitor() override = default; + ~CastVisitor() override = default; }; //###################################################################### diff --git a/src/V3Cdc.cpp b/src/V3Cdc.cpp index 56e26ebe8..6a6323a15 100644 --- a/src/V3Cdc.cpp +++ b/src/V3Cdc.cpp @@ -67,9 +67,9 @@ public: , m_srcDomainSet{false} , m_dstDomainSet{false} , m_asyncPath{false} {} - virtual ~CdcEitherVertex() override = default; + ~CdcEitherVertex() override = default; // ACCESSORS - virtual FileLine* fileline() const override { return nodep()->fileline(); } + FileLine* fileline() const override { return nodep()->fileline(); } AstScope* scopep() const { return m_scopep; } AstNode* nodep() const { return m_nodep; } AstSenTree* srcDomainp() const { return m_srcDomainp; } @@ -93,11 +93,11 @@ public: CdcVarVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp) : CdcEitherVertex{graphp, scopep, varScp} , m_varScp{varScp} {} - virtual ~CdcVarVertex() override = default; + ~CdcVarVertex() override = default; // ACCESSORS AstVarScope* varScp() const { return m_varScp; } - virtual string name() const override { return (cvtToHex(m_varScp) + " " + varScp()->name()); } - virtual string dotColor() const override { + string name() const override { return (cvtToHex(m_varScp) + " " + varScp()->name()); } + string dotColor() const override { return fromFlop() ? "green" : cntAsyncRst() ? "red" : "blue"; } int cntAsyncRst() const { return m_cntAsyncRst; } @@ -118,12 +118,10 @@ public: srcDomainp(sensenodep); dstDomainp(sensenodep); } - virtual ~CdcLogicVertex() override = default; + ~CdcLogicVertex() override = default; // ACCESSORS - virtual string name() const override { - return (cvtToHex(nodep()) + "@" + scopep()->prettyName()); - } - virtual string dotColor() const override { return hazard() ? "black" : "yellow"; } + string name() const override { return (cvtToHex(nodep()) + "@" + scopep()->prettyName()); } + string dotColor() const override { return hazard() ? "black" : "yellow"; } bool hazard() const { return m_hazard; } void setHazard(AstNode* nodep) { m_hazard = true; @@ -144,7 +142,7 @@ private: std::ofstream* const m_ofp = nullptr; // Output file string m_prefix; - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { *m_ofp << m_prefix; if (nodep->user3()) { *m_ofp << " %%"; @@ -171,7 +169,7 @@ public: , m_prefix{prefix} { iterate(nodep); } - virtual ~CdcDumpVisitor() override = default; + ~CdcDumpVisitor() override = default; }; //###################################################################### @@ -181,7 +179,7 @@ private: int m_maxLineno = 0; size_t m_maxFilenameLen = 0; - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { iterateChildren(nodep); // Keeping line+filename lengths separate is much faster than calling ascii().length() if (nodep->fileline()->lineno() >= m_maxLineno) { @@ -195,7 +193,7 @@ private: public: // CONSTRUCTORS explicit CdcWidthVisitor(AstNode* nodep) { iterate(nodep); } - virtual ~CdcWidthVisitor() override = default; + ~CdcWidthVisitor() override = default; // ACCESSORS int maxWidth() const { size_t width = 1; @@ -628,21 +626,21 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); { m_modp = nodep; iterateChildren(nodep); } } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { UINFO(4, " SCOPE " << nodep << endl); m_scopep = nodep; m_logicVertexp = nullptr; iterateChildren(nodep); m_scopep = nullptr; } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { // Create required blocks and add to module UINFO(4, " BLOCK " << nodep << endl); AstNode::user2ClearTree(); @@ -654,7 +652,7 @@ private: m_domainp = nullptr; AstNode::user2ClearTree(); } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { if (m_scopep) { UASSERT_OBJ(m_logicVertexp, nodep, "Var ref not under a logic block"); AstVarScope* const varscp = nodep->varScopep(); @@ -682,53 +680,53 @@ private: } } } - virtual void visit(AstAssignDly* nodep) override { + void visit(AstAssignDly* nodep) override { m_inDly = true; iterateChildren(nodep); m_inDly = false; } - virtual void visit(AstSenItem* nodep) override { + void visit(AstSenItem* nodep) override { m_inSenItem = true; iterateChildren(nodep); m_inSenItem = false; } - virtual void visit(AstAlways* nodep) override { iterateNewStmt(nodep); } - virtual void visit(AstAlwaysPublic* nodep) override { + void visit(AstAlways* nodep) override { iterateNewStmt(nodep); } + void visit(AstAlwaysPublic* nodep) override { // CDC doesn't care about public variables } - virtual void visit(AstCFunc* nodep) override { iterateNewStmt(nodep); } - virtual void visit(AstAssignAlias* nodep) override { iterateNewStmt(nodep); } - virtual void visit(AstAssignW* nodep) override { iterateNewStmt(nodep); } + void visit(AstCFunc* nodep) override { iterateNewStmt(nodep); } + void visit(AstAssignAlias* nodep) override { iterateNewStmt(nodep); } + void visit(AstAssignW* nodep) override { iterateNewStmt(nodep); } // Math that shouldn't cause us to clear hazard - virtual void visit(AstConst*) override {} - virtual void visit(AstReplicate* nodep) override { iterateChildren(nodep); } - virtual void visit(AstConcat* nodep) override { iterateChildren(nodep); } - virtual void visit(AstNot* nodep) override { iterateChildren(nodep); } - virtual void visit(AstSel* nodep) override { + void visit(AstConst*) override {} + void visit(AstReplicate* nodep) override { iterateChildren(nodep); } + void visit(AstConcat* nodep) override { iterateChildren(nodep); } + void visit(AstNot* nodep) override { iterateChildren(nodep); } + void visit(AstSel* nodep) override { if (!VN_IS(nodep->lsbp(), Const)) setNodeHazard(nodep); iterateChildren(nodep); } - virtual void visit(AstNodeSel* nodep) override { + void visit(AstNodeSel* nodep) override { if (!VN_IS(nodep->bitp(), Const)) setNodeHazard(nodep); iterateChildren(nodep); } // Ignores - virtual void visit(AstInitial*) override {} - virtual void visit(AstInitialAutomatic*) override {} - virtual void visit(AstInitialStatic*) override {} - virtual void visit(AstTraceDecl*) override {} - virtual void visit(AstCoverToggle*) override {} - virtual void visit(AstNodeDType*) override {} + void visit(AstInitial*) override {} + void visit(AstInitialAutomatic*) override {} + void visit(AstInitialStatic*) override {} + void visit(AstTraceDecl*) override {} + void visit(AstCoverToggle*) override {} + void visit(AstNodeDType*) override {} //-------------------- // Default - virtual void visit(AstNodeMath* nodep) override { + void visit(AstNodeMath* nodep) override { setNodeHazard(nodep); iterateChildren(nodep); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -754,7 +752,7 @@ public: *m_ofp << '\n'; } } - virtual ~CdcVisitor() override { + ~CdcVisitor() override { if (m_ofp) VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } }; diff --git a/src/V3Changed.cpp b/src/V3Changed.cpp index 32bf3d4c5..f99b40284 100644 --- a/src/V3Changed.cpp +++ b/src/V3Changed.cpp @@ -155,13 +155,13 @@ private: m_state.m_numStmts += initp->nodeCount() + m_varEqnp->widthWords(); } - virtual void visit(AstBasicDType*) override { // + void visit(AstBasicDType*) override { // newChangeDet(); } - virtual void visit(AstPackArrayDType*) override { // + void visit(AstPackArrayDType*) override { // newChangeDet(); } - virtual void visit(AstUnpackArrayDType* nodep) override { + void visit(AstUnpackArrayDType* nodep) override { for (int index = 0; index < nodep->elementsConst(); ++index) { VL_RESTORER(m_varEqnp); VL_RESTORER(m_newLvEqnp); @@ -181,7 +181,7 @@ private: } } } - virtual void visit(AstNodeUOrStructDType* nodep) override { + void visit(AstNodeUOrStructDType* nodep) override { if (nodep->packedUnsup()) { newChangeDet(); } else { @@ -191,7 +191,7 @@ private: << m_vscp->varp()->prettyNameQ()); } } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { iterateChildren(nodep); if (debug()) nodep->dumpTree(cout, "-DETECTARRAY-general-"); m_vscp->v3warn(E_DETECTARRAY, "Unsupported: Can't detect changes on complex variable" @@ -231,7 +231,7 @@ public: m_newLvEqnp->deleteTree(); m_newRvEqnp->deleteTree(); } - virtual ~ChangedInsertVisitor() override = default; + ~ChangedInsertVisitor() override = default; VL_UNCOPYABLE(ChangedInsertVisitor); }; diff --git a/src/V3Class.cpp b/src/V3Class.cpp index 94f513802..52a7c0f1f 100644 --- a/src/V3Class.cpp +++ b/src/V3Class.cpp @@ -49,7 +49,7 @@ private: // METHODS VL_DEBUG_FUNC; // Declare debug() - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { if (nodep->user1SetOnce()) return; // Move this class nodep->name(m_prefix + nodep->name()); @@ -100,7 +100,7 @@ private: } nodep->repairCache(); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { // Visit for NodeModules that are not AstClass (AstClass is-a AstNodeModule) VL_RESTORER(m_prefix); { @@ -109,7 +109,7 @@ private: } } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { iterateChildren(nodep); if (m_packageScopep) { if (m_ftaskp && m_ftaskp->lifetime().isStatic()) { @@ -127,12 +127,12 @@ private: } } - virtual void visit(AstVarScope* nodep) override { + void visit(AstVarScope* nodep) override { iterateChildren(nodep); nodep->varp()->user1p(nodep); } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { VL_RESTORER(m_ftaskp); { m_ftaskp = nodep; @@ -142,7 +142,7 @@ private: } } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { iterateChildren(nodep); // Don't move now, or wouldn't keep interating the class // TODO move function statics only @@ -150,14 +150,14 @@ private: // m_toScopeMoves.push_back(std::make_pair(nodep, m_classScopep)); //} } - virtual void visit(AstInitial* nodep) override { + void visit(AstInitial* nodep) override { // But not AstInitialAutomatic, which remains under the class iterateChildren(nodep); if (m_packageScopep) { m_toScopeMoves.emplace_back(std::make_pair(nodep, m_packageScopep)); } } - virtual void visit(AstInitialStatic* nodep) override { + void visit(AstInitialStatic* nodep) override { // But not AstInitialAutomatic, which remains under the class iterateChildren(nodep); if (m_packageScopep) { @@ -165,14 +165,14 @@ private: } } - virtual void visit(AstNodeMath* nodep) override {} // Short circuit - virtual void visit(AstNodeStmt* nodep) override {} // Short circuit - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath* nodep) override {} // Short circuit + void visit(AstNodeStmt* nodep) override {} // Short circuit + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit ClassVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~ClassVisitor() override { + ~ClassVisitor() override { for (auto moved : m_toScopeMoves) { AstNode* const nodep = moved.first; AstScope* const scopep = moved.second; diff --git a/src/V3Clean.cpp b/src/V3Clean.cpp index 3cca98d7f..64fa0dcba 100644 --- a/src/V3Clean.cpp +++ b/src/V3Clean.cpp @@ -173,64 +173,64 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); { m_modp = nodep; iterateChildren(nodep); } } - virtual void visit(AstNodeUniop* nodep) override { + void visit(AstNodeUniop* nodep) override { iterateChildren(nodep); computeCppWidth(nodep); if (nodep->cleanLhs()) ensureClean(nodep->lhsp()); setClean(nodep, nodep->cleanOut()); } - virtual void visit(AstNodeBiop* nodep) override { + void visit(AstNodeBiop* nodep) override { operandBiop(nodep); setClean(nodep, nodep->cleanOut()); } - virtual void visit(AstAnd* nodep) override { + void visit(AstAnd* nodep) override { operandBiop(nodep); setClean(nodep, isClean(nodep->lhsp()) || isClean(nodep->rhsp())); } - virtual void visit(AstXor* nodep) override { + void visit(AstXor* nodep) override { operandBiop(nodep); setClean(nodep, isClean(nodep->lhsp()) && isClean(nodep->rhsp())); } - virtual void visit(AstOr* nodep) override { + void visit(AstOr* nodep) override { operandBiop(nodep); setClean(nodep, isClean(nodep->lhsp()) && isClean(nodep->rhsp())); } - virtual void visit(AstNodeQuadop* nodep) override { + void visit(AstNodeQuadop* nodep) override { operandQuadop(nodep); setClean(nodep, nodep->cleanOut()); } - virtual void visit(AstNodeMath* nodep) override { + void visit(AstNodeMath* nodep) override { iterateChildren(nodep); computeCppWidth(nodep); setClean(nodep, nodep->cleanOut()); } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { iterateChildren(nodep); computeCppWidth(nodep); if (nodep->cleanRhs()) ensureClean(nodep->rhsp()); } - virtual void visit(AstText* nodep) override { // + void visit(AstText* nodep) override { // setClean(nodep, true); } - virtual void visit(AstScopeName* nodep) override { // + void visit(AstScopeName* nodep) override { // setClean(nodep, true); } - virtual void visit(AstCNew* nodep) override { + void visit(AstCNew* nodep) override { iterateChildren(nodep); setClean(nodep, true); } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { operandTriop(nodep); setClean(nodep, nodep->cleanOut()); } - virtual void visit(AstUCFunc* nodep) override { + void visit(AstUCFunc* nodep) override { iterateChildren(nodep); computeCppWidth(nodep); setClean(nodep, false); @@ -238,69 +238,69 @@ private: if (!VN_IS(nodep->backp(), And)) insertClean(nodep); ensureCleanAndNext(nodep->bodysp()); } - virtual void visit(AstTraceDecl* nodep) override { + void visit(AstTraceDecl* nodep) override { // No cleaning, or would loose pointer to enum iterateChildren(nodep); } - virtual void visit(AstTraceInc* nodep) override { + void visit(AstTraceInc* nodep) override { iterateChildren(nodep); ensureCleanAndNext(nodep->valuep()); } - virtual void visit(AstTypedef* nodep) override { + void visit(AstTypedef* nodep) override { // No cleaning, or would loose pointer to enum iterateChildren(nodep); } - virtual void visit(AstParamTypeDType* nodep) override { + void visit(AstParamTypeDType* nodep) override { // No cleaning, or would loose pointer to enum iterateChildren(nodep); } // Control flow operators - virtual void visit(AstNodeCond* nodep) override { + void visit(AstNodeCond* nodep) override { iterateChildren(nodep); ensureClean(nodep->condp()); setClean(nodep, isClean(nodep->expr1p()) && isClean(nodep->expr2p())); } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { iterateChildren(nodep); ensureClean(nodep->condp()); } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { iterateChildren(nodep); ensureClean(nodep->condp()); } - virtual void visit(AstSFormatF* nodep) override { + void visit(AstSFormatF* nodep) override { iterateChildren(nodep); ensureCleanAndNext(nodep->exprsp()); setClean(nodep, true); // generates a string, so not relevant } - virtual void visit(AstUCStmt* nodep) override { + void visit(AstUCStmt* nodep) override { iterateChildren(nodep); ensureCleanAndNext(nodep->bodysp()); } - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { iterateChildren(nodep); ensureCleanAndNext(nodep->argsp()); setClean(nodep, true); } - virtual void visit(AstCMethodHard* nodep) override { + void visit(AstCMethodHard* nodep) override { iterateChildren(nodep); ensureCleanAndNext(nodep->pinsp()); setClean(nodep, true); } - virtual void visit(AstWith* nodep) override { + void visit(AstWith* nodep) override { iterateChildren(nodep); ensureCleanAndNext(nodep->exprp()); setClean(nodep, true); } - virtual void visit(AstIntfRef* nodep) override { + void visit(AstIntfRef* nodep) override { iterateChildren(nodep); setClean(nodep, true); // generates a string, so not relevant } //-------------------- // Default: Just iterate - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { iterateChildren(nodep); computeCppWidth(nodep); } @@ -308,7 +308,7 @@ private: public: // CONSTRUCTORS explicit CleanVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~CleanVisitor() override = default; + ~CleanVisitor() override = default; }; //###################################################################### diff --git a/src/V3Clock.cpp b/src/V3Clock.cpp index f750d2059..95e10270d 100644 --- a/src/V3Clock.cpp +++ b/src/V3Clock.cpp @@ -242,7 +242,7 @@ private: } // VISITORS - virtual void visit(AstTopScope* nodep) override { + void visit(AstTopScope* nodep) override { UINFO(4, " TOPSCOPE " << nodep << endl); m_topScopep = nodep; m_scopep = nodep->scopep(); @@ -277,7 +277,7 @@ private: m_topScopep = nullptr; m_scopep = nullptr; } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { // UINFO(4, " MOD " << nodep << endl); VL_RESTORER(m_modp); { @@ -285,7 +285,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { // UINFO(4, " SCOPE " << nodep << endl); m_scopep = nodep; iterateChildren(nodep); @@ -296,14 +296,14 @@ private: } m_scopep = nullptr; } - virtual void visit(AstNodeProcedure* nodep) override { + void visit(AstNodeProcedure* nodep) override { if (AstNode* const stmtsp = nodep->bodysp()) { stmtsp->unlinkFrBackWithNext(); nodep->addNextHere(stmtsp); } VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstCoverToggle* nodep) override { + void visit(AstCoverToggle* nodep) override { // nodep->dumpTree(cout, "ct:"); // COVERTOGGLE(INC, ORIG, CHANGE) -> // IF(ORIG ^ CHANGE) { INC; CHANGE = ORIG; } @@ -320,7 +320,7 @@ private: nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { iterateChildren(nodep); // Link to global function if (nodep->isFinal()) { @@ -329,7 +329,7 @@ private: m_finalFuncp->addStmtsp(callp); } } - virtual void visit(AstSenTree* nodep) override { + void visit(AstSenTree* nodep) override { // Delete it later; Actives still pointing to it nodep->unlinkFrBack(); pushDeletep(nodep); @@ -343,7 +343,7 @@ private: void addToInitial(AstNode* stmtsp) { m_initFuncp->addStmtsp(stmtsp); // add to top level function } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { // Careful if adding variables here, ACTIVES can be under other ACTIVES // Need to save and restore any member state in AstUntilStable block if (!m_topScopep || !nodep->stmtsp()) { @@ -411,7 +411,7 @@ private: VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } } - virtual void visit(AstExecGraph* nodep) override { + void visit(AstExecGraph* nodep) override { VL_RESTORER(m_mtaskBodyp); for (m_mtaskBodyp = nodep->mTaskBodiesp(); m_mtaskBodyp; m_mtaskBodyp = VN_AS(m_mtaskBodyp->nextp(), MTaskBody)) { @@ -427,7 +427,7 @@ private: } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -437,7 +437,7 @@ public: // easily without iterating through the tree. nodep->evalp(m_evalFuncp); } - virtual ~ClockVisitor() override = default; + ~ClockVisitor() override = default; }; //###################################################################### diff --git a/src/V3Combine.cpp b/src/V3Combine.cpp index 8fa0edbeb..e372629d0 100644 --- a/src/V3Combine.cpp +++ b/src/V3Combine.cpp @@ -180,32 +180,32 @@ class CombineVisitor final : VNVisitor { } // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Gather functions and references iterateChildrenConst(nodep); // Combine functions process(nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { UASSERT_OBJ(!m_modp, nodep, "Should not nest"); m_modp = nodep; iterateChildrenConst(nodep); m_modp = nullptr; } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { iterateChildrenConst(nodep); if (nodep->dontCombine()) return; auto& coll = nodep->slow() ? m_cfuncs(m_modp).m_slow : m_cfuncs(m_modp).m_fast; coll.emplace_back(nodep); } - virtual void visit(AstCCall* nodep) override { + void visit(AstCCall* nodep) override { iterateChildrenConst(nodep); AstCFunc* const funcp = nodep->funcp(); if (funcp->dontCombine()) return; m_callSites(funcp).emplace_back(nodep); } - virtual void visit(AstAddrOfCFunc* nodep) override { + void visit(AstAddrOfCFunc* nodep) override { iterateChildrenConst(nodep); if (nodep->funcp()->dontCombine()) return; // LCOV_EXCL_START @@ -217,7 +217,7 @@ class CombineVisitor final : VNVisitor { } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildrenConst(nodep); } + void visit(AstNode* nodep) override { iterateChildrenConst(nodep); } // CONSTRUCTORS explicit CombineVisitor(AstNetlist* nodep) { iterate(nodep); } diff --git a/src/V3Const.cpp b/src/V3Const.cpp index 2c5f10f7b..ba3b75edb 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -417,14 +417,12 @@ class ConstBitOpTreeVisitor final : public VNVisitor { } // VISITORS - virtual void visit(AstNode* nodep) override { - CONST_BITOP_SET_FAILED("Hit unexpected op", nodep); - } - virtual void visit(AstCCast* nodep) override { + void visit(AstNode* nodep) override { CONST_BITOP_SET_FAILED("Hit unexpected op", nodep); } + void visit(AstCCast* nodep) override { iterateChildren(nodep); if (m_leafp) m_leafp->updateBitRange(nodep); } - virtual void visit(AstShiftR* nodep) override { + void visit(AstShiftR* nodep) override { CONST_BITOP_RETURN_IF(!m_leafp, nodep); AstConst* const constp = VN_CAST(nodep->rhsp(), Const); CONST_BITOP_RETURN_IF(!constp, nodep->rhsp()); @@ -434,7 +432,7 @@ class ConstBitOpTreeVisitor final : public VNVisitor { m_leafp->updateBitRange(nodep); m_lsb -= constp->toUInt(); } - virtual void visit(AstNot* nodep) override { + void visit(AstNot* nodep) override { CONST_BITOP_RETURN_IF(nodep->widthMin() != 1, nodep); AstNode* lhsp = nodep->lhsp(); AstCCast* const castp = VN_CAST(lhsp, CCast); @@ -449,7 +447,7 @@ class ConstBitOpTreeVisitor final : public VNVisitor { if (!isXorTree()) m_polarity = !m_polarity; if (m_leafp && castp) m_leafp->updateBitRange(castp); } - virtual void visit(AstWordSel* nodep) override { + void visit(AstWordSel* nodep) override { CONST_BITOP_RETURN_IF(!m_leafp, nodep); AstConst* const constp = VN_CAST(nodep->bitp(), Const); CONST_BITOP_RETURN_IF(!constp, nodep->rhsp()); @@ -457,17 +455,17 @@ class ConstBitOpTreeVisitor final : public VNVisitor { m_leafp->wordIdx(constp->toSInt()); iterate(nodep->fromp()); } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { CONST_BITOP_RETURN_IF(!m_leafp, nodep); m_leafp->setLeaf(nodep); m_leafp->polarity(m_polarity); } - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { CONST_BITOP_RETURN_IF(!m_leafp, nodep); m_leafp->setLeaf(nodep); } - virtual void visit(AstRedXor* nodep) override { + void visit(AstRedXor* nodep) override { Restorer restorer{*this}; CONST_BITOP_RETURN_IF(!VN_IS(m_rootp, Xor), nodep); AstNode* lhsp = nodep->lhsp(); @@ -514,7 +512,7 @@ class ConstBitOpTreeVisitor final : public VNVisitor { } } - virtual void visit(AstNodeBiop* nodep) override { + void visit(AstNodeBiop* nodep) override { if (VN_IS(nodep, And) && isConst(nodep->lhsp(), 1)) { // 1 & _ // Always reach past a plain making AND Restorer restorer{*this}; @@ -2252,11 +2250,11 @@ private: //---------------------------------------- // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Iterate modules backwards, in bottom-up order. That's faster iterateChildrenBackwards(nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); { m_modp = nodep; @@ -2264,7 +2262,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { // No ASSIGNW removals under funcs, we've long eliminated INITIALs // (We should perhaps rename the assignw's to just assigns) VL_RESTORER(m_wremove); @@ -2273,7 +2271,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { // No ASSIGNW removals under scope, we've long eliminated INITIALs VL_RESTORER(m_wremove); VL_RESTORER(m_scopep); @@ -2370,17 +2368,17 @@ private: } // Special cases - virtual void visit(AstConst*) override {} // Already constant + void visit(AstConst*) override {} // Already constant - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { if (m_params) { iterateAndNextNull(nodep->paramsp()); } else { iterateChildren(nodep); } } - virtual void visit(AstClassOrPackageRef* nodep) override { iterateChildren(nodep); } - virtual void visit(AstPin* nodep) override { iterateChildren(nodep); } + void visit(AstClassOrPackageRef* nodep) override { iterateChildren(nodep); } + void visit(AstPin* nodep) override { iterateChildren(nodep); } void replaceLogEq(AstLogEq* nodep) { // LOGEQ(a,b) => AstLogAnd{AstLogOr{AstLogNot{a},b},AstLogOr{AstLogNot{b},a}} @@ -2562,7 +2560,7 @@ private: VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstAttrOf* nodep) override { + void visit(AstAttrOf* nodep) override { VL_RESTORER(m_attrp); { m_attrp = nodep; @@ -2570,7 +2568,7 @@ private: } } - virtual void visit(AstArraySel* nodep) override { + void visit(AstArraySel* nodep) override { iterateAndNextNull(nodep->bitp()); if (VN_IS(nodep->bitp(), Const) && VN_IS(nodep->fromp(), VarRef) @@ -2596,7 +2594,7 @@ private: } m_selp = nullptr; } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { iterateChildren(nodep); UASSERT_OBJ(nodep->varp(), nodep, "Not linked"); bool did = false; @@ -2650,7 +2648,7 @@ private: << nodep->varp()->prettyNameQ()); } } - virtual void visit(AstEnumItemRef* nodep) override { + void visit(AstEnumItemRef* nodep) override { iterateChildren(nodep); UASSERT_OBJ(nodep->itemp(), nodep, "Not linked"); bool did = false; @@ -2675,7 +2673,7 @@ private: } } - // virtual void visit(AstCvtPackString* nodep) override { + // void visit(AstCvtPackString* nodep) override { // Not constant propagated (for today) because AstNodeMath::isOpaque is set // Someday if lower is constant, convert to quoted "string". @@ -2683,7 +2681,7 @@ private: // Only one if it's not in a list return (!nodep->nextp() && nodep->backp()->nextp() != nodep); } - virtual void visit(AstSenItem* nodep) override { + void visit(AstSenItem* nodep) override { iterateChildren(nodep); if (m_doNConst && (VN_IS(nodep->sensp(), Const) || VN_IS(nodep->sensp(), EnumItemRef) @@ -2750,7 +2748,7 @@ private: } }; - virtual void visit(AstSenTree* nodep) override { + void visit(AstSenTree* nodep) override { iterateChildren(nodep); if (m_doExpensive) { // cout<dumpTree(cout, "ssin: "); @@ -2834,17 +2832,17 @@ private: //----- // Zero elimination - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { iterateChildren(nodep); if (m_doNConst && replaceNodeAssign(nodep)) return; } - virtual void visit(AstAssignAlias* nodep) override { + void visit(AstAssignAlias* nodep) override { // Don't perform any optimizations, keep the alias around } - virtual void visit(AstAssignVarScope* nodep) override { + void visit(AstAssignVarScope* nodep) override { // Don't perform any optimizations, the node won't be linked yet } - virtual void visit(AstAssignW* nodep) override { + void visit(AstAssignW* nodep) override { iterateChildren(nodep); if (m_doNConst && replaceNodeAssign(nodep)) return; AstNodeVarRef* const varrefp = VN_CAST( @@ -2871,7 +2869,7 @@ private: varrefp->varp()->valuep(initvaluep); } } - virtual void visit(AstRelease* nodep) override { + void visit(AstRelease* nodep) override { if (AstConcat* const concatp = VN_CAST(nodep->lhsp(), Concat)) { FileLine* const flp = nodep->fileline(); AstRelease* const newLp = new AstRelease{flp, concatp->lhsp()->unlinkFrBack()}; @@ -2884,7 +2882,7 @@ private: } } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { iterateChildren(nodep); if (m_doNConst) { if (const AstConst* const constp = VN_CAST(nodep->condp(), Const)) { @@ -2968,7 +2966,7 @@ private: } } - virtual void visit(AstDisplay* nodep) override { + void visit(AstDisplay* nodep) override { // DISPLAY(SFORMAT(text1)),DISPLAY(SFORMAT(text2)) -> DISPLAY(SFORMAT(text1+text2)) iterateChildren(nodep); if (stmtDisplayDisplay(nodep)) return; @@ -3022,7 +3020,7 @@ private: VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); return true; } - virtual void visit(AstSFormatF* nodep) override { + void visit(AstSFormatF* nodep) override { // Substitute constants into displays. The main point of this is to // simplify assertion methodologies which call functions with display's. // This eliminates a pile of wide temps, and makes the C a whole lot more readable. @@ -3089,17 +3087,17 @@ private: } } - virtual void visit(AstFuncRef* nodep) override { + void visit(AstFuncRef* nodep) override { iterateChildren(nodep); if (m_params) { // Only parameters force us to do constant function call propagation replaceWithSimulation(nodep); } } - virtual void visit(AstArg* nodep) override { + void visit(AstArg* nodep) override { // replaceWithSimulation on the Arg's parent FuncRef replaces these iterateChildren(nodep); } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { const bool oldHasJumpDelay = m_hasJumpDelay; m_hasJumpDelay = false; { iterateChildren(nodep); } @@ -3125,22 +3123,22 @@ private: } } } - virtual void visit(AstInitArray* nodep) override { iterateChildren(nodep); } - virtual void visit(AstInitItem* nodep) override { iterateChildren(nodep); } - virtual void visit(AstUnbounded* nodep) override { iterateChildren(nodep); } + void visit(AstInitArray* nodep) override { iterateChildren(nodep); } + void visit(AstInitItem* nodep) override { iterateChildren(nodep); } + void visit(AstUnbounded* nodep) override { iterateChildren(nodep); } // These are converted by V3Param. Don't constify as we don't want the // from() VARREF to disappear, if any. // If output of a presel didn't get consted, chances are V3Param didn't visit properly - virtual void visit(AstNodePreSel*) override {} + void visit(AstNodePreSel*) override {} // Ignored, can eliminate early - virtual void visit(AstSysIgnore* nodep) override { + void visit(AstSysIgnore* nodep) override { iterateChildren(nodep); if (m_doNConst) VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } // Simplify - virtual void visit(AstBasicDType* nodep) override { + void visit(AstBasicDType* nodep) override { iterateChildren(nodep); nodep->cvtRangeConst(); } @@ -3148,11 +3146,11 @@ private: //----- // Jump elimination - virtual void visit(AstDelay* nodep) override { + void visit(AstDelay* nodep) override { iterateChildren(nodep); m_hasJumpDelay = true; } - virtual void visit(AstJumpGo* nodep) override { + void visit(AstJumpGo* nodep) override { iterateChildren(nodep); // Jump to label where label immediately follows label is not useful if (nodep->labelp() == VN_CAST(nodep->nextp(), JumpLabel)) { @@ -3183,7 +3181,7 @@ private: m_hasJumpDelay = true; } - virtual void visit(AstJumpBlock* nodep) override { + void visit(AstJumpBlock* nodep) override { // Because JumpLabels disable many optimizations, // remove JumpLabels that are not pointed to by any AstJumpGos // Note this assumes all AstJumpGos are underneath the given label; V3Broken asserts this @@ -3537,7 +3535,7 @@ private: // Note we can't convert EqCase/NeqCase to Eq/Neq here because that would break 3'b1x1==3'b101 //----- - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { // Default: Just iterate if (m_required) { if (VN_IS(nodep, NodeDType) || VN_IS(nodep, Range) || VN_IS(nodep, SliceSel)) { @@ -3584,7 +3582,7 @@ public: } // clang-format on } - virtual ~ConstVisitor() override { + ~ConstVisitor() override { if (m_doCpp) { if (m_globalPass) { V3Stats::addStat("Optimizations, Const bit op reduction", m_statBitOpReduction); diff --git a/src/V3Coverage.cpp b/src/V3Coverage.cpp index e03be42d4..a5e8b1dc3 100644 --- a/src/V3Coverage.cpp +++ b/src/V3Coverage.cpp @@ -209,7 +209,7 @@ private: } // VISITORS - BOTH - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { const AstNodeModule* const origModp = m_modp; VL_RESTORER(m_modp); VL_RESTORER(m_state); @@ -227,9 +227,9 @@ private: } } - virtual void visit(AstNodeProcedure* nodep) override { iterateProcedure(nodep); } - virtual void visit(AstWhile* nodep) override { iterateProcedure(nodep); } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeProcedure* nodep) override { iterateProcedure(nodep); } + void visit(AstWhile* nodep) override { iterateProcedure(nodep); } + void visit(AstNodeFTask* nodep) override { if (!nodep->dpiImport()) iterateProcedure(nodep); } void iterateProcedure(AstNode* nodep) { @@ -258,7 +258,7 @@ private: } // VISITORS - TOGGLE COVERAGE - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { iterateChildren(nodep); if (m_modp && !m_inToggleOff && !m_state.m_inModOff && nodep->fileline()->coverageOn() && v3Global.opt.coverageToggle()) { @@ -383,7 +383,7 @@ private: // VISITORS - LINE COVERAGE // Note not AstNodeIf; other types don't get covered - virtual void visit(AstIf* nodep) override { + void visit(AstIf* nodep) override { UINFO(4, " IF: " << nodep << endl); if (m_state.m_on) { // An else-if. When we iterate the if, use "elsif" marking @@ -460,7 +460,7 @@ private: } UINFO(9, " done HANDLE " << m_state.m_handle << " for " << nodep << endl); } - virtual void visit(AstCaseItem* nodep) override { + void visit(AstCaseItem* nodep) override { // We don't add an explicit "default" coverage if not provided, // as we already have a warning when there is no default. UINFO(4, " CASEI: " << nodep << endl); @@ -479,7 +479,7 @@ private: } } } - virtual void visit(AstCover* nodep) override { + void visit(AstCover* nodep) override { UINFO(4, " COVER: " << nodep << endl); VL_RESTORER(m_state); { @@ -495,11 +495,11 @@ private: } } } - virtual void visit(AstStop* nodep) override { + void visit(AstStop* nodep) override { UINFO(4, " STOP: " << nodep << endl); m_state.m_on = false; } - virtual void visit(AstPragma* nodep) override { + void visit(AstPragma* nodep) override { if (nodep->pragType() == VPragmaType::COVERAGE_BLOCK_OFF) { // Skip all NEXT nodes under this block, and skip this if/case branch UINFO(4, " OFF: h" << m_state.m_handle << " " << nodep << endl); @@ -510,7 +510,7 @@ private: lineTrack(nodep); } } - virtual void visit(AstBegin* nodep) override { + void visit(AstBegin* nodep) override { // Record the hierarchy of any named begins, so we can apply to user // coverage points. This is because there may be cov points inside // generate blocks; each point should get separate consideration. @@ -529,7 +529,7 @@ private: } // VISITORS - BOTH - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { iterateChildren(nodep); lineTrack(nodep); } @@ -537,7 +537,7 @@ private: public: // CONSTRUCTORS explicit CoverageVisitor(AstNetlist* rootp) { iterateChildren(rootp); } - virtual ~CoverageVisitor() override = default; + ~CoverageVisitor() override = default; }; //###################################################################### diff --git a/src/V3CoverageJoin.cpp b/src/V3CoverageJoin.cpp index 1b16971d6..b0d081a1d 100644 --- a/src/V3CoverageJoin.cpp +++ b/src/V3CoverageJoin.cpp @@ -88,24 +88,24 @@ private: } // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Find all Coverage's iterateChildren(nodep); // Simplify detectDuplicates(); } - virtual void visit(AstCoverToggle* nodep) override { + void visit(AstCoverToggle* nodep) override { m_toggleps.push_back(nodep); iterateChildren(nodep); } //-------------------- - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit CoverageJoinVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~CoverageJoinVisitor() override { + ~CoverageJoinVisitor() override { V3Stats::addStat("Coverage, Toggle points joined", m_statToggleJoins); } }; diff --git a/src/V3Dead.cpp b/src/V3Dead.cpp index 5c6c11fb4..0d41429cd 100644 --- a/src/V3Dead.cpp +++ b/src/V3Dead.cpp @@ -102,7 +102,7 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { if (m_modp) m_modp->user1Inc(); // e.g. Class under Package VL_RESTORER(m_modp); { @@ -120,12 +120,12 @@ private: } } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { iterateChildren(nodep); checkAll(nodep); if (nodep->scopep()) nodep->scopep()->user1Inc(); } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { iterateChildren(nodep); checkAll(nodep); if (nodep->aboveScopep()) nodep->aboveScopep()->user1Inc(); @@ -136,14 +136,14 @@ private: m_scopesp.push_back(nodep); } } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { iterateChildren(nodep); checkAll(nodep); m_cellsp.push_back(nodep); nodep->modp()->user1Inc(); } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { // Note NodeAssign skips calling this in some cases iterateChildren(nodep); checkAll(nodep); @@ -155,7 +155,7 @@ private: if (nodep->varp()) nodep->varp()->user1Inc(); if (nodep->classOrPackagep()) nodep->classOrPackagep()->user1Inc(); } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { iterateChildren(nodep); checkAll(nodep); if (nodep->classOrPackagep()) { @@ -166,11 +166,11 @@ private: } } } - virtual void visit(AstMethodCall* nodep) override { + void visit(AstMethodCall* nodep) override { iterateChildren(nodep); checkAll(nodep); } - virtual void visit(AstRefDType* nodep) override { + void visit(AstRefDType* nodep) override { iterateChildren(nodep); checkDType(nodep); checkAll(nodep); @@ -184,7 +184,7 @@ private: } } } - virtual void visit(AstClassRefDType* nodep) override { + void visit(AstClassRefDType* nodep) override { iterateChildren(nodep); checkDType(nodep); checkAll(nodep); @@ -197,12 +197,12 @@ private: } if (nodep->classp()) nodep->classp()->user1Inc(); } - virtual void visit(AstNodeDType* nodep) override { + void visit(AstNodeDType* nodep) override { iterateChildren(nodep); checkDType(nodep); checkAll(nodep); } - virtual void visit(AstEnumItemRef* nodep) override { + void visit(AstEnumItemRef* nodep) override { iterateChildren(nodep); checkAll(nodep); if (nodep->classOrPackagep()) { @@ -214,13 +214,13 @@ private: } checkAll(nodep); } - virtual void visit(AstMemberSel* nodep) override { + void visit(AstMemberSel* nodep) override { iterateChildren(nodep); if (nodep->varp()) nodep->varp()->user1Inc(); if (nodep->fromp()->dtypep()) nodep->fromp()->dtypep()->user1Inc(); // classref checkAll(nodep); } - virtual void visit(AstModport* nodep) override { + void visit(AstModport* nodep) override { iterateChildren(nodep); if (m_elimCells) { if (!nodep->varsp()) { @@ -230,14 +230,14 @@ private: } checkAll(nodep); } - virtual void visit(AstSelLoopVars* nodep) override { + void visit(AstSelLoopVars* nodep) override { // Var under a SelLoopVars means we haven't called V3Width to remove them yet VL_RESTORER(m_selloopvarsp); m_selloopvarsp = nodep; iterateChildren(nodep); checkAll(nodep); } - virtual void visit(AstTypedef* nodep) override { + void visit(AstTypedef* nodep) override { iterateChildren(nodep); if (m_elimCells && !nodep->attrPublic()) { VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep); @@ -248,20 +248,20 @@ private: // Normal modules may disappear, e.g. if they are parameterized then removed if (nodep->attrPublic() && m_modp && VN_IS(m_modp, Package)) m_modp->user1Inc(); } - virtual void visit(AstVarScope* nodep) override { + void visit(AstVarScope* nodep) override { iterateChildren(nodep); checkAll(nodep); if (nodep->scopep()) nodep->scopep()->user1Inc(); if (mightElimVar(nodep->varp())) m_vscsp.push_back(nodep); } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { iterateChildren(nodep); checkAll(nodep); if (nodep->isSigPublic() && m_modp && VN_IS(m_modp, Package)) m_modp->user1Inc(); if (m_selloopvarsp) nodep->user1Inc(); if (mightElimVar(nodep)) m_varsp.push_back(nodep); } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { // See if simple assignments to variables may be eliminated because // that variable is never used. // Similar code in V3Life @@ -284,7 +284,7 @@ private: } //----- - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { if (nodep->isOutputter()) m_sideEffect = true; iterateChildren(nodep); checkAll(nodep); @@ -446,7 +446,7 @@ public: // We may have removed some datatypes, cleanup nodep->typeTablep()->repairCache(); } - virtual ~DeadVisitor() override = default; + ~DeadVisitor() override = default; }; //###################################################################### diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index ce06a16a2..f7d928d33 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -365,24 +365,24 @@ private: } // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // VV***** We reset all userp() on the netlist m_modVarMap.clear(); iterateChildren(nodep); } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { UINFO(4, " MOD " << nodep << endl); AstNode::user3ClearTree(); iterateChildren(nodep); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { VL_RESTORER(m_cfuncp); { m_cfuncp = nodep; iterateChildren(nodep); } } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { m_activep = nodep; VL_RESTORER(m_inInitial); { @@ -392,7 +392,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstAssignDly* nodep) override { + void visit(AstAssignDly* nodep) override { m_inDly = true; m_nextDlyp = VN_CAST(nodep->nextp(), AssignDly); // Next assignment in same block, maybe nullptr. @@ -426,7 +426,7 @@ private: m_nextDlyp = nullptr; } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (!nodep->user2Inc()) { // Not done yet if (m_inDly && nodep->access().isWriteOrRW()) { UINFO(4, "AssignDlyVar: " << nodep << endl); @@ -488,18 +488,18 @@ private: } } - virtual void visit(AstNodeReadWriteMem* nodep) override { + void visit(AstNodeReadWriteMem* nodep) override { VL_RESTORER(m_ignoreBlkAndNBlk); m_ignoreBlkAndNBlk = true; // $readmem/$writemem often used in mem models // so we will suppress BLKANDNBLK warnings iterateChildren(nodep); } - virtual void visit(AstNodeFor* nodep) override { // LCOV_EXCL_LINE + void visit(AstNodeFor* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc( "For statements should have been converted to while statements in V3Begin"); } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { VL_RESTORER(m_inLoop); { m_inLoop = true; @@ -508,12 +508,12 @@ private: } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit DelayedVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~DelayedVisitor() override { + ~DelayedVisitor() override { V3Stats::addStat("Optimizations, Delayed shared-sets", m_statSharedSet); } }; diff --git a/src/V3Depth.cpp b/src/V3Depth.cpp index 7b81e22ca..f370c6d09 100644 --- a/src/V3Depth.cpp +++ b/src/V3Depth.cpp @@ -73,7 +73,7 @@ private: } // VISITORS - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { VL_RESTORER(m_cfuncp); VL_RESTORER(m_mtaskbodyp); { @@ -85,7 +85,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstMTaskBody* nodep) override { + void visit(AstMTaskBody* nodep) override { VL_RESTORER(m_cfuncp); VL_RESTORER(m_mtaskbodyp); { @@ -106,7 +106,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { if (!nodep->isStatement()) { iterateChildren(nodep); } else { @@ -114,8 +114,8 @@ private: } } // Operators - virtual void visit(AstNodeTermop* nodep) override {} - virtual void visit(AstNodeMath* nodep) override { + void visit(AstNodeTermop* nodep) override {} + void visit(AstNodeMath* nodep) override { // We have some operator defines that use 2 parens, so += 2. { VL_RESTORER(m_depth); @@ -142,19 +142,19 @@ private: m_cfuncp->isStatic(false); } } - virtual void visit(AstUCFunc* nodep) override { + void visit(AstUCFunc* nodep) override { needNonStaticFunc(nodep); iterateChildren(nodep); } - virtual void visit(AstUCStmt* nodep) override { + void visit(AstUCStmt* nodep) override { needNonStaticFunc(nodep); visitStmt(nodep); } //-------------------- // Default: Just iterate - virtual void visit(AstVar*) override {} // Don't hit varrefs under vars - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} // Don't hit varrefs under vars + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -162,7 +162,7 @@ public: : m_tempNames{"__Vdeeptemp"} { iterate(nodep); } - virtual ~DepthVisitor() override = default; + ~DepthVisitor() override = default; }; //###################################################################### diff --git a/src/V3DepthBlock.cpp b/src/V3DepthBlock.cpp index 22da37e91..c4cde8287 100644 --- a/src/V3DepthBlock.cpp +++ b/src/V3DepthBlock.cpp @@ -71,7 +71,7 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { UINFO(4, " MOD " << nodep << endl); VL_RESTORER(m_modp); { @@ -80,7 +80,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { // We recurse into this. VL_RESTORER(m_depth); VL_RESTORER(m_cfuncp); @@ -106,7 +106,7 @@ private: } m_depth--; } - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { if (!nodep->isStatement()) { iterateChildren(nodep); } else { @@ -114,15 +114,15 @@ private: } } - virtual void visit(AstNodeMath*) override {} // Accelerate + void visit(AstNodeMath*) override {} // Accelerate //-------------------- - virtual void visit(AstVar*) override {} // Don't hit varrefs under vars - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} // Don't hit varrefs under vars + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit DepthBlockVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~DepthBlockVisitor() override = default; + ~DepthBlockVisitor() override = default; }; //###################################################################### diff --git a/src/V3Descope.cpp b/src/V3Descope.cpp index 4fe90837f..544bac417 100644 --- a/src/V3Descope.cpp +++ b/src/V3Descope.cpp @@ -185,11 +185,11 @@ private: } // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { nodep->dpiExportTriggerp(nullptr); iterateChildren(nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); { m_modp = nodep; @@ -199,17 +199,17 @@ private: makePublicFuncWrappers(); } } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { m_scopep = nodep; iterateChildren(nodep); m_scopep = nullptr; } - virtual void visit(AstVarScope* nodep) override { + void visit(AstVarScope* nodep) override { // Delete the varscope when we're finished nodep->unlinkFrBack(); pushDeletep(nodep); } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { iterateChildren(nodep); if (!nodep->varScopep()) { UASSERT_OBJ(nodep->varp()->isFuncLocal(), nodep, @@ -233,7 +233,7 @@ private: nodep->varScopep(nullptr); UINFO(9, " refout " << nodep << " selfPtr=" << nodep->selfPointer() << endl); } - virtual void visit(AstCCall* nodep) override { + void visit(AstCCall* nodep) override { // UINFO(9, " " << nodep << endl); iterateChildren(nodep); // Convert the hierch name @@ -243,9 +243,9 @@ private: // Can't do this, as we may have more calls later // nodep->funcp()->scopep(nullptr); } - virtual void visit(AstCMethodCall* nodep) override { iterateChildren(nodep); } - virtual void visit(AstCNew* nodep) override { iterateChildren(nodep); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCMethodCall* nodep) override { iterateChildren(nodep); } + void visit(AstCNew* nodep) override { iterateChildren(nodep); } + void visit(AstCFunc* nodep) override { VL_RESTORER(m_funcp); if (!nodep->user1()) { // Static functions should have been moved under the corresponding AstClassPackage @@ -268,13 +268,13 @@ private: } } } - virtual void visit(AstVar*) override {} - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit DescopeVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~DescopeVisitor() override = default; + ~DescopeVisitor() override = default; }; //###################################################################### diff --git a/src/V3EmitCBase.h b/src/V3EmitCBase.h index 2451cfdfc..ca293eef1 100644 --- a/src/V3EmitCBase.h +++ b/src/V3EmitCBase.h @@ -110,7 +110,7 @@ public: // CONSTRUCTORS EmitCBaseVisitor() = default; - virtual ~EmitCBaseVisitor() override = default; + ~EmitCBaseVisitor() override = default; }; #endif // guard diff --git a/src/V3EmitCConstInit.h b/src/V3EmitCConstInit.h index 6c02bf099..9c0960180 100644 --- a/src/V3EmitCConstInit.h +++ b/src/V3EmitCConstInit.h @@ -45,7 +45,7 @@ class EmitCConstInit VL_NOT_FINAL : public EmitCBaseVisitor { protected: // VISITORS - virtual void visit(AstInitArray* nodep) override { + void visit(AstInitArray* nodep) override { VL_RESTORER(m_inUnpacked); VL_RESTORER(m_unpackedWord); m_inUnpacked = true; @@ -94,11 +94,11 @@ protected: } } - virtual void visit(AstInitItem* nodep) override { // LCOV_EXCL_START + void visit(AstInitItem* nodep) override { // LCOV_EXCL_START nodep->v3fatal("Handled by AstInitArray"); } // LCOV_EXCL_STOP - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { const V3Number& num = nodep->num(); UASSERT_OBJ(!num.isFourState(), nodep, "4-state value in constant pool"); const AstNodeDType* const dtypep = nodep->dtypep(); @@ -145,7 +145,7 @@ protected: } // Default - virtual void visit(AstNode* nodep) override { // LCOV_EXCL_START + void visit(AstNode* nodep) override { // LCOV_EXCL_START nodep->v3fatalSrc("Unknown node type reached EmitCConstInit: " << nodep->prettyTypeName()); } // LCOV_EXCL_STOP }; diff --git a/src/V3EmitCConstPool.cpp b/src/V3EmitCConstPool.cpp index 2fd22ccc4..d813fc955 100644 --- a/src/V3EmitCConstPool.cpp +++ b/src/V3EmitCConstPool.cpp @@ -100,7 +100,7 @@ class EmitCConstPool final : public EmitCConstInit { } // VISITORS - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { m_outFileSize += nodep->num().isString() ? 10 : nodep->isWide() ? nodep->widthWords() : 1; EmitCConstInit::visit(nodep); } diff --git a/src/V3EmitCFunc.h b/src/V3EmitCFunc.h index 27af5ad6a..71d636cf9 100644 --- a/src/V3EmitCFunc.h +++ b/src/V3EmitCFunc.h @@ -70,17 +70,17 @@ class EmitCLazyDecls final : public VNVisitor { } // VISITORS - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { lazyDeclare(nodep->funcp()); iterateChildren(nodep); } - virtual void visit(AstAddrOfCFunc* nodep) override { + void visit(AstAddrOfCFunc* nodep) override { lazyDeclare(nodep->funcp()); iterateChildren(nodep); } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { AstVar* const varp = nodep->varp(); // Only constant pool symbols are lazy declared for now ... if (EmitCBaseVisitor::isConstPoolMod(EmitCParentModule::get(varp))) { @@ -88,7 +88,7 @@ class EmitCLazyDecls final : public VNVisitor { } } - virtual void visit(AstNode* nodep) override { iterateChildrenConst(nodep); } + void visit(AstNode* nodep) override { iterateChildrenConst(nodep); } VL_DEBUG_FUNC; @@ -213,7 +213,7 @@ public: // VISITORS using EmitCConstInit::visit; - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { VL_RESTORER(m_useSelfForThis); VL_RESTORER(m_cfuncp); m_cfuncp = nodep; @@ -281,12 +281,12 @@ public: if (nodep->ifdef() != "") puts("#endif // " + nodep->ifdef() + "\n"); } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { UASSERT_OBJ(m_cfuncp, nodep, "Cannot emit non-local variable"); emitVarDecl(nodep); } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { bool paren = true; bool decind = false; bool rhs = true; @@ -368,8 +368,8 @@ public: if (decind) ofp()->blockDec(); puts(";\n"); } - virtual void visit(AstAlwaysPublic*) override {} - virtual void visit(AstAssocSel* nodep) override { + void visit(AstAlwaysPublic*) override {} + void visit(AstAssocSel* nodep) override { iterateAndNextNull(nodep->fromp()); putbs(".at("); AstAssocArrayDType* const adtypep = VN_AS(nodep->fromp()->dtypep(), AssocArrayDType); @@ -381,7 +381,7 @@ public: } puts(")"); } - virtual void visit(AstWildcardSel* nodep) override { + void visit(AstWildcardSel* nodep) override { iterateAndNextNull(nodep->fromp()); putbs(".at("); AstWildcardArrayDType* const adtypep = VN_AS(nodep->fromp()->dtypep(), WildcardArrayDType); @@ -389,7 +389,7 @@ public: iterateAndNextNull(nodep->bitp()); puts(")"); } - virtual void visit(AstCCall* nodep) override { + void visit(AstCCall* nodep) override { const AstCFunc* const funcp = nodep->funcp(); const AstNodeModule* const funcModp = EmitCParentModule::get(funcp); if (funcp->dpiImportPrototype()) { @@ -415,7 +415,7 @@ public: } emitCCallArgs(nodep, nodep->selfPointerProtect(m_useSelfForThis)); } - virtual void visit(AstCMethodCall* nodep) override { + void visit(AstCMethodCall* nodep) override { const AstCFunc* const funcp = nodep->funcp(); UASSERT_OBJ(!funcp->isLoose(), nodep, "Loose method called via AstCMethodCall"); iterate(nodep->fromp()); @@ -423,7 +423,7 @@ public: puts(funcp->nameProtect()); emitCCallArgs(nodep, ""); } - virtual void visit(AstCNew* nodep) override { + void visit(AstCNew* nodep) override { bool comma = false; puts("std::make_shared<" + prefixNameProtect(nodep->dtypep()) + ">("); puts("vlSymsp"); // TODO make this part of argsp, and eliminate when unnecessary @@ -435,7 +435,7 @@ public: } puts(")"); } - virtual void visit(AstCMethodHard* nodep) override { + void visit(AstCMethodHard* nodep) override { iterate(nodep->fromp()); puts("."); puts(nodep->name()); @@ -457,8 +457,8 @@ public: UASSERT_OBJ(!nodep->isStatement() || VN_IS(nodep->dtypep(), VoidDType), nodep, "Statement of non-void data type"); } - virtual void visit(AstLambdaArgRef* nodep) override { putbs(nodep->nameProtect()); } - virtual void visit(AstWith* nodep) override { + void visit(AstLambdaArgRef* nodep) override { putbs(nodep->nameProtect()); } + void visit(AstWith* nodep) override { // With uses a C++11 lambda putbs("[=]("); if (auto* const argrefp = nodep->indexArgRefp()) { @@ -473,11 +473,11 @@ public: iterateAndNextNull(nodep->exprp()); puts("; }\n"); } - virtual void visit(AstNodeCase* nodep) override { // LCOV_EXCL_LINE + void visit(AstNodeCase* nodep) override { // LCOV_EXCL_LINE // In V3Case... nodep->v3fatalSrc("Case statements should have been reduced out"); } - virtual void visit(AstComment* nodep) override { + void visit(AstComment* nodep) override { string at; if (nodep->showAt()) { at = " at " + nodep->fileline()->ascii(); @@ -489,7 +489,7 @@ public: } iterateChildren(nodep); } - virtual void visit(AstCoverDecl* nodep) override { + void visit(AstCoverDecl* nodep) override { puts("vlSelf->__vlCoverInsert("); // As Declared in emitCoverageDecl puts("&(vlSymsp->__Vcoverage["); puts(cvtToStr(nodep->dataDeclThisp()->binNum())); @@ -517,7 +517,7 @@ public: putsQuoted(nodep->linescov()); puts(");\n"); } - virtual void visit(AstCoverInc* nodep) override { + void visit(AstCoverInc* nodep) override { if (v3Global.opt.threads()) { puts("vlSymsp->__Vcoverage["); puts(cvtToStr(nodep->declp()->dataDeclThisp()->binNum())); @@ -528,17 +528,17 @@ public: puts("]);\n"); } } - virtual void visit(AstCReturn* nodep) override { + void visit(AstCReturn* nodep) override { puts("return ("); iterateAndNextNull(nodep->lhsp()); puts(");\n"); } - virtual void visit(AstDisplay* nodep) override { + void visit(AstDisplay* nodep) override { string text = nodep->fmtp()->text(); if (nodep->addNewline()) text += "\n"; displayNode(nodep, nodep->fmtp()->scopeNamep(), text, nodep->fmtp()->exprsp(), false); } - virtual void visit(AstDumpCtl* nodep) override { + void visit(AstDumpCtl* nodep) override { switch (nodep->ctlType()) { case VDumpCtlType::FILE: puts("vlSymsp->_vm_contextp__->dumpfile("); @@ -577,7 +577,7 @@ public: default: nodep->v3fatalSrc("Bad case, unexpected " << nodep->ctlType().ascii()); } } - virtual void visit(AstScopeName* nodep) override { + void visit(AstScopeName* nodep) override { // For use under AstCCalls for dpiImports. ScopeNames under // displays are handled in AstDisplay if (!nodep->dpiExport()) { @@ -586,20 +586,20 @@ public: putbs("(&(vlSymsp->" + protect("__Vscope_" + scope) + "))"); } } - virtual void visit(AstSFormat* nodep) override { + void visit(AstSFormat* nodep) override { displayNode(nodep, nodep->fmtp()->scopeNamep(), nodep->fmtp()->text(), nodep->fmtp()->exprsp(), false); } - virtual void visit(AstSFormatF* nodep) override { + void visit(AstSFormatF* nodep) override { displayNode(nodep, nodep->scopeNamep(), nodep->text(), nodep->exprsp(), false); } - virtual void visit(AstFScanF* nodep) override { + void visit(AstFScanF* nodep) override { displayNode(nodep, nullptr, nodep->text(), nodep->exprsp(), true); } - virtual void visit(AstSScanF* nodep) override { + void visit(AstSScanF* nodep) override { displayNode(nodep, nullptr, nodep->text(), nodep->exprsp(), true); } - virtual void visit(AstValuePlusArgs* nodep) override { + void visit(AstValuePlusArgs* nodep) override { puts("VL_VALUEPLUSARGS_IN"); emitIQW(nodep->outp()); puts("("); @@ -611,19 +611,19 @@ public: iterateAndNextNull(nodep->outp()); puts(")"); } - virtual void visit(AstTestPlusArgs* nodep) override { + void visit(AstTestPlusArgs* nodep) override { puts("VL_TESTPLUSARGS_I("); emitCvtPackStr(nodep->searchp()); puts(")"); } - virtual void visit(AstFError* nodep) override { + void visit(AstFError* nodep) override { puts("VL_FERROR_IN("); iterateAndNextNull(nodep->filep()); putbs(", "); iterateAndNextNull(nodep->strp()); puts(")"); } - virtual void visit(AstFGetS* nodep) override { + void visit(AstFGetS* nodep) override { checkMaxWords(nodep); emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), nullptr); } @@ -636,7 +636,7 @@ public: << " bits exceeds hardcoded limit VL_VALUE_STRING_MAX_WORDS in verilatedos.h"); } } - virtual void visit(AstFOpen* nodep) override { + void visit(AstFOpen* nodep) override { iterateAndNextNull(nodep->filep()); puts(" = VL_FOPEN_NN("); emitCvtPackStr(nodep->filenamep()); @@ -646,13 +646,13 @@ public: emitCvtPackStr(nodep->modep()); puts(");\n"); } - virtual void visit(AstFOpenMcd* nodep) override { + void visit(AstFOpenMcd* nodep) override { iterateAndNextNull(nodep->filep()); puts(" = VL_FOPEN_MCD_N("); emitCvtPackStr(nodep->filenamep()); puts(");\n"); } - virtual void visit(AstNodeReadWriteMem* nodep) override { + void visit(AstNodeReadWriteMem* nodep) override { puts(nodep->cFuncPrefixp()); puts("N("); puts(nodep->isHex() ? "true" : "false"); @@ -701,14 +701,14 @@ public: } puts(");\n"); } - virtual void visit(AstFClose* nodep) override { + void visit(AstFClose* nodep) override { puts("VL_FCLOSE_I("); iterateAndNextNull(nodep->filep()); puts("); "); iterateAndNextNull(nodep->filep()); // For safety, so user doesn't later WRITE with it. puts(" = 0;\n"); } - virtual void visit(AstFFlush* nodep) override { + void visit(AstFFlush* nodep) override { if (!nodep->filep()) { puts("Verilated::runFlushCallbacks();\n"); } else { @@ -719,7 +719,7 @@ public: puts("); }\n"); } } - virtual void visit(AstFSeek* nodep) override { + void visit(AstFSeek* nodep) override { puts("(VL_FSEEK_I("); iterateAndNextNull(nodep->filep()); puts(","); @@ -728,17 +728,17 @@ public: iterateAndNextNull(nodep->operation()); puts(") == -1 ? -1 : 0)"); } - virtual void visit(AstFTell* nodep) override { + void visit(AstFTell* nodep) override { puts("VL_FTELL_I("); iterateAndNextNull(nodep->filep()); puts(")"); } - virtual void visit(AstFRewind* nodep) override { + void visit(AstFRewind* nodep) override { puts("(VL_FSEEK_I("); iterateAndNextNull(nodep->filep()); puts(", 0, 0) == -1 ? -1 : 0)"); } - virtual void visit(AstFRead* nodep) override { + void visit(AstFRead* nodep) override { puts("VL_FREAD_I("); puts(cvtToStr(nodep->memp()->widthMin())); // Need real storage width putbs(","); @@ -781,12 +781,12 @@ public: } puts(")"); } - virtual void visit(AstSysFuncAsTask* nodep) override { + void visit(AstSysFuncAsTask* nodep) override { if (!nodep->lhsp()->isWide()) puts("(void)"); iterateAndNextNull(nodep->lhsp()); if (!nodep->lhsp()->isWide()) puts(";"); } - virtual void visit(AstSystemT* nodep) override { + void visit(AstSystemT* nodep) override { puts("(void)VL_SYSTEM_I"); emitIQW(nodep->lhsp()); puts("("); @@ -798,7 +798,7 @@ public: iterateAndNextNull(nodep->lhsp()); puts(");\n"); } - virtual void visit(AstSystemF* nodep) override { + void visit(AstSystemF* nodep) override { puts("VL_SYSTEM_I"); emitIQW(nodep->lhsp()); puts("("); @@ -810,20 +810,20 @@ public: iterateAndNextNull(nodep->lhsp()); puts(")"); } - virtual void visit(AstJumpBlock* nodep) override { + void visit(AstJumpBlock* nodep) override { nodep->labelNum(++m_labelNum); puts("{\n"); // Make it visually obvious label jumps outside these iterateAndNextNull(nodep->stmtsp()); iterateAndNextNull(nodep->endStmtsp()); puts("}\n"); } - virtual void visit(AstJumpGo* nodep) override { + void visit(AstJumpGo* nodep) override { puts("goto __Vlabel" + cvtToStr(nodep->labelp()->blockp()->labelNum()) + ";\n"); } - virtual void visit(AstJumpLabel* nodep) override { + void visit(AstJumpLabel* nodep) override { puts("__Vlabel" + cvtToStr(nodep->blockp()->labelNum()) + ": ;\n"); } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { iterateAndNextNull(nodep->precondsp()); puts("while ("); iterateAndNextNull(nodep->condp()); @@ -833,7 +833,7 @@ public: iterateAndNextNull(nodep->precondsp()); // Need to recompute before next loop puts("}\n"); } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { puts("if ("); if (!nodep->branchPred().unknown()) { puts(nodep->branchPred().ascii()); @@ -857,7 +857,7 @@ public: } } } - virtual void visit(AstExprStmt* nodep) override { + void visit(AstExprStmt* nodep) override { // GCC allows compound statements in expressions, but this is not standard. // So we use an immediate-evaluation lambda and comma operator putbs("([&]() {\n"); @@ -866,7 +866,7 @@ public: iterateAndNextNull(nodep->resultp()); puts(")"); } - virtual void visit(AstStop* nodep) override { + void visit(AstStop* nodep) override { puts("VL_STOP_MT("); putsQuoted(protect(nodep->fileline()->filename())); puts(", "); @@ -874,38 +874,38 @@ public: puts(", \"\""); puts(");\n"); } - virtual void visit(AstFinish* nodep) override { + void visit(AstFinish* nodep) override { puts("VL_FINISH_MT("); putsQuoted(protect(nodep->fileline()->filename())); puts(", "); puts(cvtToStr(nodep->fileline()->lineno())); puts(", \"\");\n"); } - virtual void visit(AstPrintTimeScale* nodep) override { + void visit(AstPrintTimeScale* nodep) override { puts("VL_PRINTTIMESCALE("); putsQuoted(protect(nodep->name())); puts(", "); putsQuoted(nodep->timeunit().ascii()); puts(", vlSymsp->_vm_contextp__);\n"); } - virtual void visit(AstRand* nodep) override { + void visit(AstRand* nodep) override { emitOpName(nodep, nodep->emitC(), nodep->seedp(), nullptr, nullptr); } - virtual void visit(AstTime* nodep) override { + void visit(AstTime* nodep) override { puts("VL_TIME_UNITED_Q("); if (nodep->timeunit().isNone()) nodep->v3fatalSrc("$time has no units"); puts(cvtToStr(nodep->timeunit().multiplier() / v3Global.rootp()->timeprecision().multiplier())); puts(")"); } - virtual void visit(AstTimeD* nodep) override { + void visit(AstTimeD* nodep) override { puts("VL_TIME_UNITED_D("); if (nodep->timeunit().isNone()) nodep->v3fatalSrc("$realtime has no units"); puts(cvtToStr(nodep->timeunit().multiplier() / v3Global.rootp()->timeprecision().multiplier())); puts(")"); } - virtual void visit(AstTimeFormat* nodep) override { + void visit(AstTimeFormat* nodep) override { puts("VL_TIMEFORMAT_IINI("); iterateAndNextNull(nodep->unitsp()); puts(", "); @@ -916,7 +916,7 @@ public: iterateAndNextNull(nodep->widthp()); puts(", vlSymsp->_vm_contextp__);\n"); } - virtual void visit(AstNodeSimpleText* nodep) override { + void visit(AstNodeSimpleText* nodep) override { const string text = m_inUC && m_useSelfForThis ? VString::replaceWord(nodep->text(), "this", "vlSelf") : nodep->text(); @@ -926,29 +926,29 @@ public: ofp()->putsNoTracking(text); } } - virtual void visit(AstTextBlock* nodep) override { + void visit(AstTextBlock* nodep) override { visit(static_cast(nodep)); for (AstNode* childp = nodep->nodesp(); childp; childp = childp->nextp()) { iterate(childp); if (nodep->commas() && childp->nextp()) puts(", "); } } - virtual void visit(AstCStmt* nodep) override { + void visit(AstCStmt* nodep) override { putbs(""); iterateAndNextNull(nodep->bodysp()); } - virtual void visit(AstCMath* nodep) override { + void visit(AstCMath* nodep) override { putbs(""); iterateAndNextNull(nodep->bodysp()); } - virtual void visit(AstUCStmt* nodep) override { + void visit(AstUCStmt* nodep) override { VL_RESTORER(m_inUC); m_inUC = true; putsDecoration(ifNoProtect("// $c statement at " + nodep->fileline()->ascii() + "\n")); iterateAndNextNull(nodep->bodysp()); puts("\n"); } - virtual void visit(AstUCFunc* nodep) override { + void visit(AstUCFunc* nodep) override { VL_RESTORER(m_inUC); m_inUC = true; puts("\n"); @@ -958,10 +958,10 @@ public: } // Operators - virtual void visit(AstNodeTermop* nodep) override { + void visit(AstNodeTermop* nodep) override { emitOpName(nodep, nodep->emitC(), nullptr, nullptr, nullptr); } - virtual void visit(AstNodeUniop* nodep) override { + void visit(AstNodeUniop* nodep) override { if (nodep->emitCheckMaxWords() && (nodep->widthWords() > VL_MULS_MAX_WORDS || nodep->lhsp()->widthWords() > VL_MULS_MAX_WORDS)) { @@ -981,7 +981,7 @@ public: emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nullptr, nullptr); } } - virtual void visit(AstNodeBiop* nodep) override { + void visit(AstNodeBiop* nodep) override { if (nodep->emitCheckMaxWords() && nodep->widthWords() > VL_MULS_MAX_WORDS) { nodep->v3warn( E_UNSUPPORTED, @@ -1001,11 +1001,11 @@ public: emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), nullptr); } } - virtual void visit(AstNodeTriop* nodep) override { + void visit(AstNodeTriop* nodep) override { UASSERT_OBJ(!emitSimpleOk(nodep), nodep, "Triop cannot be described in a simple way"); emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), nodep->thsp()); } - virtual void visit(AstRedXor* nodep) override { + void visit(AstRedXor* nodep) override { if (nodep->lhsp()->isWide()) { visit(static_cast(nodep)); } else { @@ -1021,7 +1021,7 @@ public: puts(")"); } } - virtual void visit(AstCCast* nodep) override { + void visit(AstCCast* nodep) override { // Extending a value of the same word width is just a NOP. if (nodep->size() <= VL_IDATASIZE) { puts("(IData)("); @@ -1031,7 +1031,7 @@ public: iterateAndNextNull(nodep->lhsp()); puts(")"); } - virtual void visit(AstNodeCond* nodep) override { + void visit(AstNodeCond* nodep) override { // Widths match up already, so we'll just use C++'s operator w/o any temps. if (nodep->expr1p()->isWide()) { emitOpName(nodep, nodep->emitC(), nodep->condp(), nodep->expr1p(), nodep->expr2p()); @@ -1045,12 +1045,12 @@ public: puts(")"); } } - virtual void visit(AstMemberSel* nodep) override { + void visit(AstMemberSel* nodep) override { iterateAndNextNull(nodep->fromp()); putbs("->"); puts(nodep->varp()->nameProtect()); } - virtual void visit(AstNullCheck* nodep) override { + void visit(AstNullCheck* nodep) override { puts("VL_NULL_CHECK("); iterateAndNextNull(nodep->lhsp()); puts(", "); @@ -1059,17 +1059,17 @@ public: puts(cvtToStr(nodep->fileline()->lineno())); puts(")"); } - virtual void visit(AstNewCopy* nodep) override { + void visit(AstNewCopy* nodep) override { puts("std::make_shared<" + prefixNameProtect(nodep->dtypep()) + ">("); puts("*"); // i.e. make into a reference iterateAndNextNull(nodep->rhsp()); puts(")"); } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { // Note ASSIGN checks for this on a LHS emitOpName(nodep, nodep->emitC(), nodep->fromp(), nodep->lsbp(), nodep->thsp()); } - virtual void visit(AstReplicate* nodep) override { + void visit(AstReplicate* nodep) override { if (nodep->lhsp()->widthMin() == 1 && !nodep->isWide()) { UASSERT_OBJ((static_cast(VN_AS(nodep->rhsp(), Const)->toUInt()) * nodep->lhsp()->widthMin()) @@ -1088,7 +1088,7 @@ public: emitOpName(nodep, nodep->emitC(), nodep->lhsp(), nodep->rhsp(), nullptr); } } - virtual void visit(AstStreamL* nodep) override { + void visit(AstStreamL* nodep) override { // Attempt to use a "fast" stream function for slice size = power of 2 if (!nodep->isWide()) { const uint32_t isPow2 = VN_AS(nodep->rhsp(), Const)->num().countOnes() == 1; @@ -1110,14 +1110,14 @@ public: emitOpName(nodep, "VL_STREAML_%nq%lq%rq(%lw, %P, %li, %ri)", nodep->lhsp(), nodep->rhsp(), nullptr); } - virtual void visit(AstCastDynamic* nodep) override { + void visit(AstCastDynamic* nodep) override { putbs("VL_CAST_DYNAMIC("); iterateAndNextNull(nodep->lhsp()); puts(", "); iterateAndNextNull(nodep->rhsp()); puts(")"); } - virtual void visit(AstCountBits* nodep) override { + void visit(AstCountBits* nodep) override { putbs("VL_COUNTBITS_"); emitIQW(nodep->lhsp()); puts("("); @@ -1137,9 +1137,9 @@ public: iterateAndNextNull(nodep->fhsp()); puts(")"); } - virtual void visit(AstInitItem* nodep) override { iterateChildren(nodep); } + void visit(AstInitItem* nodep) override { iterateChildren(nodep); } // Terminals - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { const AstVar* const varp = nodep->varp(); const AstNodeModule* const varModp = EmitCParentModule::get(varp); if (isConstPoolMod(varModp)) { @@ -1156,14 +1156,14 @@ public: } puts(nodep->varp()->nameProtect()); } - virtual void visit(AstAddrOfCFunc* nodep) override { + void visit(AstAddrOfCFunc* nodep) override { // Note: Can be thought to handle more, but this is all that is needed right now const AstCFunc* const funcp = nodep->funcp(); UASSERT_OBJ(funcp->isLoose(), nodep, "Cannot take address of non-loose method"); puts("&"); puts(funcNameProtect(funcp)); } - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { if (m_emitConstInit) { EmitCConstInit::visit(nodep); } else if (nodep->isWide()) { @@ -1176,12 +1176,12 @@ public: } // - virtual void visit(AstMTaskBody* nodep) override { + void visit(AstMTaskBody* nodep) override { VL_RESTORER(m_useSelfForThis); m_useSelfForThis = true; iterateChildrenConst(nodep); } - virtual void visit(AstConsAssoc* nodep) override { + void visit(AstConsAssoc* nodep) override { putbs(nodep->dtypep()->cType("", false, false)); puts("()"); if (nodep->defaultp()) { @@ -1190,7 +1190,7 @@ public: puts(")"); } } - virtual void visit(AstSetAssoc* nodep) override { + void visit(AstSetAssoc* nodep) override { iterateAndNextNull(nodep->lhsp()); putbs(".set("); iterateAndNextNull(nodep->keyp()); @@ -1199,7 +1199,7 @@ public: iterateAndNextNull(nodep->valuep()); puts(")"); } - virtual void visit(AstConsWildcard* nodep) override { + void visit(AstConsWildcard* nodep) override { putbs(nodep->dtypep()->cType("", false, false)); puts("()"); if (nodep->defaultp()) { @@ -1208,7 +1208,7 @@ public: puts(")"); } } - virtual void visit(AstSetWildcard* nodep) override { + void visit(AstSetWildcard* nodep) override { iterateAndNextNull(nodep->lhsp()); putbs(".set("); iterateAndNextNull(nodep->keyp()); @@ -1217,7 +1217,7 @@ public: iterateAndNextNull(nodep->valuep()); puts(")"); } - virtual void visit(AstConsDynArray* nodep) override { + void visit(AstConsDynArray* nodep) override { putbs(nodep->dtypep()->cType("", false, false)); if (!nodep->lhsp()) { puts("()"); @@ -1232,7 +1232,7 @@ public: puts(")"); } } - virtual void visit(AstConsQueue* nodep) override { + void visit(AstConsQueue* nodep) override { putbs(nodep->dtypep()->cType("", false, false)); if (!nodep->lhsp()) { puts("()"); @@ -1247,22 +1247,22 @@ public: puts(")"); } } - virtual void visit(AstCReset* nodep) override { + void visit(AstCReset* nodep) override { AstVar* const varp = nodep->varrefp()->varp(); emitVarReset(varp); } - virtual void visit(AstExecGraph* nodep) override { + void visit(AstExecGraph* nodep) override { // The location of the AstExecGraph within the containing AstCFunc is where we want to // invoke the graph and wait for it to complete. Emitting the children does just that. UASSERT_OBJ(!nodep->mTaskBodiesp(), nodep, "These should have been lowered"); iterateChildrenConst(nodep); } - virtual void visit(AstChangeDet* nodep) override { // + void visit(AstChangeDet* nodep) override { // m_blkChangeDetVec.push_back(nodep); } // Default - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { puts(string("\n???? // ") + nodep->prettyTypeName() + "\n"); iterateChildren(nodep); // LCOV_EXCL_START @@ -1280,7 +1280,7 @@ public: m_trackText = trackText; iterate(nodep); } - virtual ~EmitCFunc() override = default; + ~EmitCFunc() override = default; }; #endif // guard diff --git a/src/V3EmitCHeaders.cpp b/src/V3EmitCHeaders.cpp index a32f261d0..2a5c7985b 100644 --- a/src/V3EmitCHeaders.cpp +++ b/src/V3EmitCHeaders.cpp @@ -326,7 +326,7 @@ class EmitCHeader final : public EmitCConstInit { // Close output file VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } - virtual ~EmitCHeader() override = default; + ~EmitCHeader() override = default; public: static void main(const AstNodeModule* modp) { EmitCHeader emitCHeader(modp); } diff --git a/src/V3EmitCImp.cpp b/src/V3EmitCImp.cpp index 988a8b7fd..cced5d818 100644 --- a/src/V3EmitCImp.cpp +++ b/src/V3EmitCImp.cpp @@ -68,59 +68,59 @@ class EmitCGatherDependencies final : VNVisitor { } // VISITORS - virtual void visit(AstCCall* nodep) override { + void visit(AstCCall* nodep) override { addSelfDependency(nodep->selfPointer(), nodep->funcp()); iterateChildrenConst(nodep); } - virtual void visit(AstCNew* nodep) override { + void visit(AstCNew* nodep) override { addDTypeDependency(nodep->dtypep()); iterateChildrenConst(nodep); } - virtual void visit(AstCMethodCall* nodep) override { + void visit(AstCMethodCall* nodep) override { addDTypeDependency(nodep->fromp()->dtypep()); iterateChildrenConst(nodep); } - virtual void visit(AstNewCopy* nodep) override { + void visit(AstNewCopy* nodep) override { addDTypeDependency(nodep->dtypep()); iterateChildrenConst(nodep); } - virtual void visit(AstMemberSel* nodep) override { + void visit(AstMemberSel* nodep) override { addDTypeDependency(nodep->fromp()->dtypep()); iterateChildrenConst(nodep); } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { addSelfDependency(nodep->selfPointer(), nodep->varp()); iterateChildrenConst(nodep); } - virtual void visit(AstCoverDecl* nodep) override { + void visit(AstCoverDecl* nodep) override { addSymsDependency(); iterateChildrenConst(nodep); } - virtual void visit(AstCoverInc* nodep) override { + void visit(AstCoverInc* nodep) override { addSymsDependency(); iterateChildrenConst(nodep); } - virtual void visit(AstDumpCtl* nodep) override { + void visit(AstDumpCtl* nodep) override { addSymsDependency(); iterateChildrenConst(nodep); } - virtual void visit(AstScopeName* nodep) override { + void visit(AstScopeName* nodep) override { addSymsDependency(); iterateChildrenConst(nodep); } - virtual void visit(AstPrintTimeScale* nodep) override { + void visit(AstPrintTimeScale* nodep) override { addSymsDependency(); iterateChildrenConst(nodep); } - virtual void visit(AstTimeFormat* nodep) override { + void visit(AstTimeFormat* nodep) override { addSymsDependency(); iterateChildrenConst(nodep); } - virtual void visit(AstNodeSimpleText* nodep) override { + void visit(AstNodeSimpleText* nodep) override { if (nodep->text().find("vlSymsp") != string::npos) addSymsDependency(); iterateChildrenConst(nodep); } - virtual void visit(AstNode* nodep) override { iterateChildrenConst(nodep); } + void visit(AstNode* nodep) override { iterateChildrenConst(nodep); } // CONSTRUCTOR explicit EmitCGatherDependencies(AstCFunc* cfuncp) { @@ -512,7 +512,7 @@ class EmitCImp final : EmitCFunc { } // VISITORS - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { if (splitNeeded()) { // Splitting file, so using parallel build. v3Global.useParallelBuild(true); @@ -544,7 +544,7 @@ class EmitCImp final : EmitCFunc { // Emit implementations of all AstCFunc emitCFuncImp(modp); } - virtual ~EmitCImp() override = default; + ~EmitCImp() override = default; public: static void main(const AstNodeModule* modp, bool slow, std::deque& cfilesr) { @@ -823,7 +823,7 @@ class EmitCTrace final : EmitCFunc { // VISITORS using EmitCFunc::visit; // Suppress hidden overloaded virtual function warning - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { if (!nodep->isTrace()) return; if (nodep->slow() != m_slow) return; @@ -838,17 +838,17 @@ class EmitCTrace final : EmitCFunc { EmitCFunc::visit(nodep); } - virtual void visit(AstTracePushNamePrefix* nodep) override { + void visit(AstTracePushNamePrefix* nodep) override { puts("tracep->pushNamePrefix("); putsQuoted(VIdProtect::protectWordsIf(nodep->prefix(), nodep->protect())); puts(");\n"); } - virtual void visit(AstTracePopNamePrefix* nodep) override { // + void visit(AstTracePopNamePrefix* nodep) override { // puts("tracep->popNamePrefix("); puts(cvtToStr(nodep->count())); puts(");\n"); } - virtual void visit(AstTraceDecl* nodep) override { + void visit(AstTraceDecl* nodep) override { const int enumNum = emitTraceDeclDType(nodep->dtypep()); if (nodep->arrayRange().ranged()) { puts("for (int i = 0; i < " + cvtToStr(nodep->arrayRange().elements()) + "; ++i) {\n"); @@ -859,7 +859,7 @@ class EmitCTrace final : EmitCFunc { puts("\n"); } } - virtual void visit(AstTraceInc* nodep) override { + void visit(AstTraceInc* nodep) override { if (nodep->declp()->arrayRange().ranged()) { // It traces faster if we unroll the loop for (int i = 0; i < nodep->declp()->arrayRange().elements(); i++) { @@ -883,7 +883,7 @@ class EmitCTrace final : EmitCFunc { // Close output file VL_DO_CLEAR(delete m_ofp, m_ofp = nullptr); } - virtual ~EmitCTrace() override = default; + ~EmitCTrace() override = default; public: static void main(AstNodeModule* modp, bool slow, std::deque& cfilesr) { diff --git a/src/V3EmitCInlines.cpp b/src/V3EmitCInlines.cpp index f9a667e25..36b92ffec 100644 --- a/src/V3EmitCInlines.cpp +++ b/src/V3EmitCInlines.cpp @@ -32,18 +32,18 @@ class EmitCInlines final : EmitCBaseVisitor { // METHODS // VISITORS - virtual void visit(AstCNew* nodep) override { + void visit(AstCNew* nodep) override { if (v3Global.opt.savable()) v3warn(E_UNSUPPORTED, "Unsupported: --savable with dynamic new"); iterateChildren(nodep); } - virtual void visit(AstDumpCtl* nodep) override { + void visit(AstDumpCtl* nodep) override { if (v3Global.opt.trace()) v3Global.needTraceDumper(true); iterateChildren(nodep); } //--------------------------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: explicit EmitCInlines(AstNetlist* nodep) { iterate(nodep); } diff --git a/src/V3EmitCMain.cpp b/src/V3EmitCMain.cpp index be04510aa..10314155f 100644 --- a/src/V3EmitCMain.cpp +++ b/src/V3EmitCMain.cpp @@ -32,7 +32,7 @@ class EmitCMain final : EmitCBaseVisitor { // VISITORS // This visitor doesn't really iterate, but exist to appease base class - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } // LCOV_EXCL_LINE + void visit(AstNode* nodep) override { iterateChildren(nodep); } // LCOV_EXCL_LINE public: // CONSTRUCTORS diff --git a/src/V3EmitCModel.cpp b/src/V3EmitCModel.cpp index c8dc7b521..2c2239306 100644 --- a/src/V3EmitCModel.cpp +++ b/src/V3EmitCModel.cpp @@ -190,7 +190,7 @@ class EmitCModel final : public EmitCFunc { + "C* tfp, int levels, int options = 0);\n"); if (optSystemC()) { puts("/// SC tracing; avoid overloaded virtual function lint warning\n"); - puts("virtual void trace(sc_trace_file* tfp) const override { " + puts("void trace(sc_trace_file* tfp) const override { " "::sc_core::sc_module::trace(tfp); }\n"); } } diff --git a/src/V3EmitCSyms.cpp b/src/V3EmitCSyms.cpp index 2bff31190..deff75056 100644 --- a/src/V3EmitCSyms.cpp +++ b/src/V3EmitCSyms.cpp @@ -258,7 +258,7 @@ class EmitCSyms final : EmitCBaseVisitor { } // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Collect list of scopes iterateChildren(nodep); varsExpand(); @@ -280,8 +280,8 @@ class EmitCSyms final : EmitCBaseVisitor { if (!m_dpiHdrOnly) emitDpiImp(); } } - virtual void visit(AstConstPool* nodep) override {} // Ignore - virtual void visit(AstNodeModule* nodep) override { + void visit(AstConstPool* nodep) override {} // Ignore + void visit(AstNodeModule* nodep) override { nameCheck(nodep); VL_RESTORER(m_modp); { @@ -289,7 +289,7 @@ class EmitCSyms final : EmitCBaseVisitor { iterateChildren(nodep); } } - virtual void visit(AstCellInline* nodep) override { + void visit(AstCellInline* nodep) override { if (v3Global.opt.vpi()) { const string type = (nodep->origModName() == "__BEGIN__") ? "SCOPE_OTHER" : "SCOPE_MODULE"; @@ -300,7 +300,7 @@ class EmitCSyms final : EmitCBaseVisitor { std::make_pair(name, ScopeData(scopeSymString(name), name_dedot, timeunit, type))); } } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { if (VN_IS(m_modp, Class)) return; // The ClassPackage is what is visible nameCheck(nodep); @@ -315,7 +315,7 @@ class EmitCSyms final : EmitCBaseVisitor { timeunit, type))); } } - virtual void visit(AstScopeName* nodep) override { + void visit(AstScopeName* nodep) override { const string name = nodep->scopeSymName(); // UINFO(9,"scnameins sp "<name()<<" sp "<scopePrettySymName() // <<" ss"<isSigUserRdPublic() && !m_cfuncp) m_modVars.emplace_back(std::make_pair(m_modp, nodep)); } - virtual void visit(AstCoverDecl* nodep) override { + void visit(AstCoverDecl* nodep) override { // Assign numbers to all bins, so we know how big of an array to use if (!nodep->dataDeclNullp()) { // else duplicate we don't need code for nodep->binNum(m_coverBins++); } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { nameCheck(nodep); if (nodep->dpiImportPrototype() || nodep->dpiExportDispatcher()) m_dpis.push_back(nodep); VL_RESTORER(m_cfuncp); @@ -360,8 +360,8 @@ class EmitCSyms final : EmitCBaseVisitor { } //--------------------------------------- - virtual void visit(AstConst*) override {} - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstConst*) override {} + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: explicit EmitCSyms(AstNetlist* nodep, bool dpiHdrOnly) diff --git a/src/V3EmitV.cpp b/src/V3EmitV.cpp index 1bd2c3a47..76144011b 100644 --- a/src/V3EmitV.cpp +++ b/src/V3EmitV.cpp @@ -53,14 +53,14 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } // VISITORS - virtual void visit(AstNetlist* nodep) override { iterateAndNextConstNull(nodep->modulesp()); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNetlist* nodep) override { iterateAndNextConstNull(nodep->modulesp()); } + void visit(AstNodeModule* nodep) override { putfs(nodep, nodep->verilogKwd() + " " + prefixNameProtect(nodep) + ";\n"); iterateChildrenConst(nodep); putqs(nodep, "end" + nodep->verilogKwd() + "\n"); } - virtual void visit(AstPort* nodep) override {} - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstPort* nodep) override {} + void visit(AstNodeFTask* nodep) override { putfs(nodep, nodep->isFunction() ? "function" : "task"); puts(" "); puts(nodep->prettyName()); @@ -70,7 +70,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { putfs(nodep, nodep->isFunction() ? "endfunction\n" : "endtask\n"); } - virtual void visit(AstBegin* nodep) override { + void visit(AstBegin* nodep) override { if (nodep->name() == "") { putbs("begin\n"); } else { @@ -79,7 +79,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateChildrenConst(nodep); puts("end\n"); } - virtual void visit(AstFork* nodep) override { + void visit(AstFork* nodep) override { if (nodep->name() == "") { putbs("fork\n"); } else { @@ -89,19 +89,19 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { puts(nodep->joinType().verilogKwd()); puts("\n"); } - virtual void visit(AstFinal* nodep) override { + void visit(AstFinal* nodep) override { putfs(nodep, "final begin\n"); iterateChildrenConst(nodep); putqs(nodep, "end\n"); } - virtual void visit(AstInitial* nodep) override { + void visit(AstInitial* nodep) override { putfs(nodep, "initial begin\n"); iterateChildrenConst(nodep); putqs(nodep, "end\n"); } - virtual void visit(AstInitialAutomatic* nodep) override { iterateChildrenConst(nodep); } - virtual void visit(AstInitialStatic* nodep) override { iterateChildrenConst(nodep); } - virtual void visit(AstAlways* nodep) override { + void visit(AstInitialAutomatic* nodep) override { iterateChildrenConst(nodep); } + void visit(AstInitialStatic* nodep) override { iterateChildrenConst(nodep); } + void visit(AstAlways* nodep) override { putfs(nodep, "always "); if (m_sensesp) { iterateAndNextConstNull(m_sensesp); @@ -113,7 +113,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateAndNextConstNull(nodep->bodysp()); putqs(nodep, "end\n"); } - virtual void visit(AstAlwaysPublic* nodep) override { + void visit(AstAlwaysPublic* nodep) override { putfs(nodep, "/*verilator public_flat_rw "); if (m_sensesp) { iterateAndNextConstNull(m_sensesp); @@ -125,43 +125,43 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateAndNextConstNull(nodep->bodysp()); putqs(nodep, "*/\n"); } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { if (VN_IS(nodep, AssignForce)) puts("force "); iterateAndNextConstNull(nodep->lhsp()); putfs(nodep, " " + nodep->verilogKwd() + " "); iterateAndNextConstNull(nodep->rhsp()); if (!m_suppressSemi) puts(";\n"); } - virtual void visit(AstAssignDly* nodep) override { + void visit(AstAssignDly* nodep) override { iterateAndNextConstNull(nodep->lhsp()); putfs(nodep, " <= "); iterateAndNextConstNull(nodep->rhsp()); puts(";\n"); } - virtual void visit(AstAssignAlias* nodep) override { + void visit(AstAssignAlias* nodep) override { putbs("alias "); iterateAndNextConstNull(nodep->lhsp()); putfs(nodep, " = "); iterateAndNextConstNull(nodep->rhsp()); if (!m_suppressSemi) puts(";\n"); } - virtual void visit(AstAssignW* nodep) override { + void visit(AstAssignW* nodep) override { putfs(nodep, "assign "); iterateAndNextConstNull(nodep->lhsp()); putbs(" = "); iterateAndNextConstNull(nodep->rhsp()); if (!m_suppressSemi) puts(";\n"); } - virtual void visit(AstRelease* nodep) override { + void visit(AstRelease* nodep) override { puts("release "); iterateAndNextConstNull(nodep->lhsp()); if (!m_suppressSemi) puts(";\n"); } - virtual void visit(AstBreak*) override { + void visit(AstBreak*) override { putbs("break"); if (!m_suppressSemi) puts(";\n"); } - virtual void visit(AstSenTree* nodep) override { + void visit(AstSenTree* nodep) override { // AstSenItem is called for dumping in isolation by V3Order putfs(nodep, "@("); for (AstNode* expp = nodep->sensesp(); expp; expp = expp->nextp()) { @@ -170,13 +170,13 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } puts(")"); } - virtual void visit(AstSenItem* nodep) override { + void visit(AstSenItem* nodep) override { putfs(nodep, ""); puts(nodep->edgeType().verilogKwd()); if (nodep->sensp()) puts(" "); iterateChildrenConst(nodep); } - virtual void visit(AstNodeCase* nodep) override { + void visit(AstNodeCase* nodep) override { putfs(nodep, ""); if (const AstCase* const casep = VN_CAST(nodep, Case)) { if (casep->priorityPragma()) puts("priority "); @@ -197,7 +197,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateAndNextConstNull(nodep->itemsp()); putqs(nodep, "endcase\n"); } - virtual void visit(AstCaseItem* nodep) override { + void visit(AstCaseItem* nodep) override { if (nodep->condsp()) { iterateAndNextConstNull(nodep->condsp()); } else { @@ -207,17 +207,17 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateAndNextConstNull(nodep->bodysp()); putqs(nodep, "end\n"); } - virtual void visit(AstComment* nodep) override { + void visit(AstComment* nodep) override { puts(std::string{"// "} + nodep->name() + "\n"); iterateChildrenConst(nodep); } - virtual void visit(AstContinue*) override { + void visit(AstContinue*) override { putbs("continue"); if (!m_suppressSemi) puts(";\n"); } - virtual void visit(AstCoverDecl*) override {} // N/A - virtual void visit(AstCoverInc*) override {} // N/A - virtual void visit(AstCoverToggle*) override {} // N/A + void visit(AstCoverDecl*) override {} // N/A + void visit(AstCoverInc*) override {} // N/A + void visit(AstCoverToggle*) override {} // N/A void visitNodeDisplay(AstNode* nodep, AstNode* fileOrStrgp, const string& text, AstNode* exprsp) { @@ -234,26 +234,26 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } puts(");\n"); } - virtual void visit(AstDisable* nodep) override { putbs("disable " + nodep->name() + ";\n"); } - virtual void visit(AstDisplay* nodep) override { + void visit(AstDisable* nodep) override { putbs("disable " + nodep->name() + ";\n"); } + void visit(AstDisplay* nodep) override { visitNodeDisplay(nodep, nodep->filep(), nodep->fmtp()->text(), nodep->fmtp()->exprsp()); } - virtual void visit(AstElabDisplay* nodep) override { + void visit(AstElabDisplay* nodep) override { visitNodeDisplay(nodep, nullptr, nodep->fmtp()->text(), nodep->fmtp()->exprsp()); } - virtual void visit(AstFScanF* nodep) override { + void visit(AstFScanF* nodep) override { visitNodeDisplay(nodep, nodep->filep(), nodep->text(), nodep->exprsp()); } - virtual void visit(AstSScanF* nodep) override { + void visit(AstSScanF* nodep) override { visitNodeDisplay(nodep, nodep->fromp(), nodep->text(), nodep->exprsp()); } - virtual void visit(AstSFormat* nodep) override { + void visit(AstSFormat* nodep) override { visitNodeDisplay(nodep, nodep->lhsp(), nodep->fmtp()->text(), nodep->fmtp()->exprsp()); } - virtual void visit(AstSFormatF* nodep) override { + void visit(AstSFormatF* nodep) override { visitNodeDisplay(nodep, nullptr, nodep->text(), nodep->exprsp()); } - virtual void visit(AstFOpen* nodep) override { + void visit(AstFOpen* nodep) override { putfs(nodep, nodep->verilogKwd()); putbs("("); iterateAndNextConstNull(nodep->filenamep()); @@ -261,36 +261,34 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateAndNextConstNull(nodep->modep()); puts(");\n"); } - virtual void visit(AstFOpenMcd* nodep) override { + void visit(AstFOpenMcd* nodep) override { putfs(nodep, nodep->verilogKwd()); putbs("("); iterateAndNextConstNull(nodep->filenamep()); puts(");\n"); } - virtual void visit(AstFClose* nodep) override { + void visit(AstFClose* nodep) override { putfs(nodep, nodep->verilogKwd()); putbs("("); if (nodep->filep()) iterateAndNextConstNull(nodep->filep()); puts(");\n"); } - virtual void visit(AstFFlush* nodep) override { + void visit(AstFFlush* nodep) override { putfs(nodep, nodep->verilogKwd()); putbs("("); if (nodep->filep()) iterateAndNextConstNull(nodep->filep()); puts(");\n"); } - virtual void visit(AstJumpBlock* nodep) override { + void visit(AstJumpBlock* nodep) override { putbs("begin : label" + cvtToStr(nodep->labelNum()) + "\n"); if (nodep->stmtsp()) iterateAndNextConstNull(nodep->stmtsp()); puts("end\n"); } - virtual void visit(AstJumpGo* nodep) override { + void visit(AstJumpGo* nodep) override { putbs("disable label" + cvtToStr(nodep->labelp()->blockp()->labelNum()) + ";\n"); } - virtual void visit(AstJumpLabel* nodep) override { - putbs("// " + cvtToStr(nodep->blockp()) + ":\n"); - } - virtual void visit(AstNodeReadWriteMem* nodep) override { + void visit(AstJumpLabel* nodep) override { putbs("// " + cvtToStr(nodep->blockp()) + ":\n"); } + void visit(AstNodeReadWriteMem* nodep) override { putfs(nodep, nodep->verilogKwd()); putbs("("); if (nodep->filenamep()) iterateAndNextConstNull(nodep->filenamep()); @@ -306,17 +304,17 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } puts(");\n"); } - virtual void visit(AstSysFuncAsTask* nodep) override { + void visit(AstSysFuncAsTask* nodep) override { iterateAndNextConstNull(nodep->lhsp()); puts(";\n"); } - virtual void visit(AstSysIgnore* nodep) override { + void visit(AstSysIgnore* nodep) override { putfs(nodep, nodep->verilogKwd()); putbs("("); iterateAndNextConstNull(nodep->exprsp()); puts(");\n"); } - virtual void visit(AstNodeFor* nodep) override { + void visit(AstNodeFor* nodep) override { putfs(nodep, "for ("); { VL_RESTORER(m_suppressSemi); @@ -331,14 +329,14 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateAndNextConstNull(nodep->bodysp()); putqs(nodep, "end\n"); } - virtual void visit(AstRepeat* nodep) override { + void visit(AstRepeat* nodep) override { putfs(nodep, "repeat ("); iterateAndNextConstNull(nodep->countp()); puts(") begin\n"); iterateAndNextConstNull(nodep->bodysp()); putfs(nodep, "end\n"); } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { iterateAndNextConstNull(nodep->precondsp()); putfs(nodep, "while ("); iterateAndNextConstNull(nodep->condp()); @@ -348,7 +346,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateAndNextConstNull(nodep->precondsp()); // Need to recompute before next loop putfs(nodep, "end\n"); } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { putfs(nodep, ""); if (const AstIf* const ifp = VN_CAST(nodep, If)) { if (ifp->priorityPragma()) puts("priority "); @@ -366,7 +364,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } putqs(nodep, "end\n"); } - virtual void visit(AstPast* nodep) override { + void visit(AstPast* nodep) override { putfs(nodep, "$past("); iterateAndNextConstNull(nodep->exprp()); if (nodep->ticksp()) { @@ -375,21 +373,21 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } puts(")"); } - virtual void visit(AstReturn* nodep) override { + void visit(AstReturn* nodep) override { putfs(nodep, "return "); iterateAndNextConstNull(nodep->lhsp()); puts(";\n"); } - virtual void visit(AstStop* nodep) override { putfs(nodep, "$stop;\n"); } - virtual void visit(AstFinish* nodep) override { putfs(nodep, "$finish;\n"); } - virtual void visit(AstNodeSimpleText* nodep) override { + void visit(AstStop* nodep) override { putfs(nodep, "$stop;\n"); } + void visit(AstFinish* nodep) override { putfs(nodep, "$finish;\n"); } + void visit(AstNodeSimpleText* nodep) override { if (nodep->tracking() || m_trackText) { puts(nodep->text()); } else { putsNoTracking(nodep->text()); } } - virtual void visit(AstTextBlock* nodep) override { + void visit(AstTextBlock* nodep) override { visit(static_cast(nodep)); { VL_RESTORER(m_suppressSemi); @@ -400,23 +398,23 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } } } - virtual void visit(AstScopeName* nodep) override {} - virtual void visit(AstCStmt* nodep) override { + void visit(AstScopeName* nodep) override {} + void visit(AstCStmt* nodep) override { putfs(nodep, "$_CSTMT("); iterateAndNextConstNull(nodep->bodysp()); puts(");\n"); } - virtual void visit(AstCMath* nodep) override { + void visit(AstCMath* nodep) override { putfs(nodep, "$_CMATH("); iterateAndNextConstNull(nodep->bodysp()); puts(");\n"); } - virtual void visit(AstUCStmt* nodep) override { + void visit(AstUCStmt* nodep) override { putfs(nodep, "$c("); iterateAndNextConstNull(nodep->bodysp()); puts(");\n"); } - virtual void visit(AstUCFunc* nodep) override { + void visit(AstUCFunc* nodep) override { putfs(nodep, "$c("); iterateAndNextConstNull(nodep->bodysp()); puts(")"); @@ -481,25 +479,23 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } } - virtual void visit(AstNodeTermop* nodep) override { - emitVerilogFormat(nodep, nodep->emitVerilog()); - } - virtual void visit(AstNodeUniop* nodep) override { + void visit(AstNodeTermop* nodep) override { emitVerilogFormat(nodep, nodep->emitVerilog()); } + void visit(AstNodeUniop* nodep) override { emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp()); } - virtual void visit(AstNodeBiop* nodep) override { + void visit(AstNodeBiop* nodep) override { emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp(), nodep->rhsp()); } - virtual void visit(AstNodeTriop* nodep) override { + void visit(AstNodeTriop* nodep) override { emitVerilogFormat(nodep, nodep->emitVerilog(), nodep->lhsp(), nodep->rhsp(), nodep->thsp()); } - virtual void visit(AstMemberSel* nodep) override { + void visit(AstMemberSel* nodep) override { iterate(nodep->fromp()); puts("."); puts(nodep->prettyName()); } - virtual void visit(AstAttrOf* nodep) override { + void visit(AstAttrOf* nodep) override { putfs(nodep, "$_ATTROF("); iterateAndNextConstNull(nodep->fromp()); if (nodep->dimp()) { @@ -508,7 +504,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } puts(")"); } - virtual void visit(AstInitArray* nodep) override { + void visit(AstInitArray* nodep) override { putfs(nodep, "'{"); int comma = 0; const auto& mapr = nodep->map(); @@ -521,7 +517,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } puts("}"); } - virtual void visit(AstNodeCond* nodep) override { + void visit(AstNodeCond* nodep) override { putbs("("); iterateAndNextConstNull(nodep->condp()); putfs(nodep, " ? "); @@ -530,7 +526,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateAndNextConstNull(nodep->expr2p()); puts(")"); } - virtual void visit(AstRange* nodep) override { + void visit(AstRange* nodep) override { puts("["); if (VN_IS(nodep->leftp(), Const) && VN_IS(nodep->rightp(), Const)) { // Looks nicer if we print [1:0] rather than [32'sh1:32sh0] @@ -545,7 +541,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { puts("]"); } } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { iterateAndNextConstNull(nodep->fromp()); puts("["); if (VN_IS(nodep->lsbp(), Const)) { @@ -569,18 +565,18 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } puts("]"); } - virtual void visit(AstSliceSel* nodep) override { + void visit(AstSliceSel* nodep) override { iterateAndNextConstNull(nodep->fromp()); puts(cvtToStr(nodep->declRange())); } - virtual void visit(AstTypedef* nodep) override { + void visit(AstTypedef* nodep) override { putfs(nodep, "typedef "); iterateAndNextConstNull(nodep->dtypep()); puts(" "); puts(nodep->prettyName()); puts(";\n"); } - virtual void visit(AstBasicDType* nodep) override { + void visit(AstBasicDType* nodep) override { if (nodep->isSigned()) putfs(nodep, "signed "); putfs(nodep, nodep->prettyName()); if (nodep->rangep()) { @@ -593,15 +589,15 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { puts(":0] "); } } - virtual void visit(AstConstDType* nodep) override { + void visit(AstConstDType* nodep) override { putfs(nodep, "const "); iterate(nodep->subDTypep()); } - virtual void visit(AstNodeArrayDType* nodep) override { + void visit(AstNodeArrayDType* nodep) override { iterate(nodep->subDTypep()); iterateAndNextConstNull(nodep->rangep()); } - virtual void visit(AstNodeUOrStructDType* nodep) override { + void visit(AstNodeUOrStructDType* nodep) override { puts(nodep->verilogKwd() + " "); if (nodep->packed()) puts("packed "); puts("\n"); @@ -609,12 +605,12 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateAndNextConstNull(nodep->membersp()); puts("}"); } - virtual void visit(AstMemberDType* nodep) override { + void visit(AstMemberDType* nodep) override { iterate(nodep->subDTypep()); puts(" "); puts(nodep->name()); } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { if (nodep->dotted() != "") { putfs(nodep, nodep->dotted()); puts("."); @@ -626,14 +622,14 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { iterateAndNextConstNull(nodep->pinsp()); puts(")"); } - virtual void visit(AstArg* nodep) override { iterateAndNextConstNull(nodep->exprp()); } - virtual void visit(AstPrintTimeScale* nodep) override { + void visit(AstArg* nodep) override { iterateAndNextConstNull(nodep->exprp()); } + void visit(AstPrintTimeScale* nodep) override { puts(nodep->verilogKwd()); puts(";\n"); } // Terminals - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (nodep->varScopep()) { putfs(nodep, nodep->varScopep()->prettyName()); } else { @@ -649,7 +645,7 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } } } - virtual void visit(AstVarXRef* nodep) override { + void visit(AstVarXRef* nodep) override { putfs(nodep, nodep->dotted()); puts("."); if (nodep->varp()) { @@ -658,12 +654,12 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { puts(nodep->prettyName()); } } - virtual void visit(AstConst* nodep) override { putfs(nodep, nodep->num().ascii(true, true)); } + void visit(AstConst* nodep) override { putfs(nodep, nodep->num().ascii(true, true)); } // Just iterate - virtual void visit(AstTopScope* nodep) override { iterateChildrenConst(nodep); } - virtual void visit(AstScope* nodep) override { iterateChildrenConst(nodep); } - virtual void visit(AstVar* nodep) override { + void visit(AstTopScope* nodep) override { iterateChildrenConst(nodep); } + void visit(AstScope* nodep) override { iterateChildrenConst(nodep); } + void visit(AstVar* nodep) override { if (nodep->isIO()) { putfs(nodep, nodep->verilogKwd()); puts(" "); @@ -691,21 +687,21 @@ class EmitVBaseVisitor VL_NOT_FINAL : public EmitCBaseVisitor { } puts(m_suppressVarSemi ? "\n" : ";\n"); } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { m_sensesp = nodep->sensesp(); iterateAndNextConstNull(nodep->stmtsp()); m_sensesp = nullptr; } - virtual void visit(AstParseRef* nodep) override { puts(nodep->prettyName()); } - virtual void visit(AstVarScope*) override {} - virtual void visit(AstNodeText*) override {} - virtual void visit(AstTraceDecl*) override {} - virtual void visit(AstTraceInc*) override {} + void visit(AstParseRef* nodep) override { puts(nodep->prettyName()); } + void visit(AstVarScope*) override {} + void visit(AstNodeText*) override {} + void visit(AstTraceDecl*) override {} + void visit(AstTraceInc*) override {} // NOPs - virtual void visit(AstPragma*) override {} - virtual void visit(AstCell*) override {} // Handled outside the Visit class + void visit(AstPragma*) override {} + void visit(AstCell*) override {} // Handled outside the Visit class // Default - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { puts(std::string{"\n???? // "} + nodep->prettyTypeName() + "\n"); iterateChildrenConst(nodep); // Not v3fatalSrc so we keep processing @@ -720,7 +716,7 @@ public: explicit EmitVBaseVisitor(bool suppressUnknown, AstSenTree* domainp) : m_suppressUnknown{suppressUnknown} , m_sensesp{domainp} {} - virtual ~EmitVBaseVisitor() override = default; + ~EmitVBaseVisitor() override = default; }; //###################################################################### @@ -731,11 +727,11 @@ class EmitVFileVisitor final : public EmitVBaseVisitor { V3OutFile* m_ofp; // METHODS V3OutFile* ofp() const { return m_ofp; } - virtual void puts(const string& str) override { ofp()->puts(str); } - virtual void putbs(const string& str) override { ofp()->putbs(str); } - virtual void putfs(AstNode*, const string& str) override { putbs(str); } - virtual void putqs(AstNode*, const string& str) override { putbs(str); } - virtual void putsNoTracking(const string& str) override { ofp()->putsNoTracking(str); } + void puts(const string& str) override { ofp()->puts(str); } + void putbs(const string& str) override { ofp()->putbs(str); } + void putfs(AstNode*, const string& str) override { putbs(str); } + void putqs(AstNode*, const string& str) override { putbs(str); } + void putsNoTracking(const string& str) override { ofp()->putsNoTracking(str); } public: EmitVFileVisitor(AstNode* nodep, V3OutFile* ofp, bool trackText, bool suppressUnknown) @@ -744,7 +740,7 @@ public: m_trackText = trackText; iterate(nodep); } - virtual ~EmitVFileVisitor() override = default; + ~EmitVFileVisitor() override = default; }; //###################################################################### @@ -754,11 +750,11 @@ class EmitVStreamVisitor final : public EmitVBaseVisitor { // MEMBERS std::ostream& m_os; // METHODS - virtual void putsNoTracking(const string& str) override { m_os << str; } - virtual void puts(const string& str) override { putsNoTracking(str); } - virtual void putbs(const string& str) override { puts(str); } - virtual void putfs(AstNode*, const string& str) override { putbs(str); } - virtual void putqs(AstNode*, const string& str) override { putbs(str); } + void putsNoTracking(const string& str) override { m_os << str; } + void puts(const string& str) override { putsNoTracking(str); } + void putbs(const string& str) override { puts(str); } + void putfs(AstNode*, const string& str) override { putbs(str); } + void putqs(AstNode*, const string& str) override { putbs(str); } public: EmitVStreamVisitor(const AstNode* nodep, std::ostream& os) @@ -766,7 +762,7 @@ public: , m_os(os) { // Need () or GCC 4.8 false warning iterate(const_cast(nodep)); } - virtual ~EmitVStreamVisitor() override = default; + ~EmitVStreamVisitor() override = default; }; //###################################################################### @@ -779,7 +775,7 @@ class EmitVPrefixedFormatter final : public V3OutFormatter { int m_column = 0; // Rough location; need just zero or non-zero FileLine* m_prefixFl; // METHODS - virtual void putcOutput(char chr) override { + void putcOutput(char chr) override { if (chr == '\n') { m_column = 0; m_os << chr; @@ -796,7 +792,7 @@ class EmitVPrefixedFormatter final : public V3OutFormatter { } } - virtual void putsOutput(const char* strg) override { + void putsOutput(const char* strg) override { for (const char* cp = strg; *cp; cp++) putcOutput(*cp); } @@ -812,7 +808,7 @@ public: m_prefixFl = v3Global.rootp()->fileline(); // NETLIST's fileline instead of nullptr to // avoid nullptr checks } - virtual ~EmitVPrefixedFormatter() override { + ~EmitVPrefixedFormatter() override { if (m_column) puts("\n"); } }; @@ -822,13 +818,13 @@ class EmitVPrefixedVisitor final : public EmitVBaseVisitor { EmitVPrefixedFormatter m_formatter; // Special verilog formatter (Way down the // inheritance is another unused V3OutFormatter) // METHODS - virtual void putsNoTracking(const string& str) override { m_formatter.putsNoTracking(str); } - virtual void puts(const string& str) override { m_formatter.puts(str); } + void putsNoTracking(const string& str) override { m_formatter.putsNoTracking(str); } + void puts(const string& str) override { m_formatter.puts(str); } // We don't use m_formatter's putbs because the tokens will change filelines // and insert returns at the proper locations - virtual void putbs(const string& str) override { m_formatter.puts(str); } - virtual void putfs(AstNode* nodep, const string& str) override { putfsqs(nodep, str, false); } - virtual void putqs(AstNode* nodep, const string& str) override { putfsqs(nodep, str, true); } + void putbs(const string& str) override { m_formatter.puts(str); } + void putfs(AstNode* nodep, const string& str) override { putfsqs(nodep, str, false); } + void putqs(AstNode* nodep, const string& str) override { putfsqs(nodep, str, true); } void putfsqs(AstNode* nodep, const string& str, bool quiet) { if (m_formatter.prefixFl() != nodep->fileline()) { m_formatter.prefixFl(nodep->fileline()); @@ -846,7 +842,7 @@ public: if (user3mark) VNUser3InUse::check(); iterate(const_cast(nodep)); } - virtual ~EmitVPrefixedVisitor() override = default; + ~EmitVPrefixedVisitor() override = default; }; //###################################################################### diff --git a/src/V3EmitXml.cpp b/src/V3EmitXml.cpp index 933f27079..bac6b6791 100644 --- a/src/V3EmitXml.cpp +++ b/src/V3EmitXml.cpp @@ -101,11 +101,11 @@ class EmitXmlFileVisitor final : public VNVisitor { } // VISITORS - virtual void visit(AstAssignW* nodep) override { + void visit(AstAssignW* nodep) override { outputTag(nodep, "contassign"); // IEEE: vpiContAssign outputChildrenEnd(nodep, "contassign"); } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { outputTag(nodep, "instance"); // IEEE: vpiInstance puts(" defName="); putsQuoted(nodep->modName()); // IEEE vpiDefName @@ -113,7 +113,7 @@ class EmitXmlFileVisitor final : public VNVisitor { putsQuoted(nodep->origName()); outputChildrenEnd(nodep, "instance"); } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { outputTag(nodep, "if"); puts(">\n"); iterateAndNextNull(nodep->op1p()); @@ -127,7 +127,7 @@ class EmitXmlFileVisitor final : public VNVisitor { } puts("\n"); } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { outputTag(nodep, "while"); puts(">\n"); puts("\n"); @@ -150,19 +150,19 @@ class EmitXmlFileVisitor final : public VNVisitor { } puts("\n"); } - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { puts("\n"); iterateChildren(nodep); puts("\n"); } - virtual void visit(AstConstPool* nodep) override { + void visit(AstConstPool* nodep) override { if (!v3Global.opt.xmlOnly()) { puts("\n"); iterateChildren(nodep); puts("\n"); } } - virtual void visit(AstInitArray* nodep) override { + void visit(AstInitArray* nodep) override { puts("\n"); const auto& mapr = nodep->map(); for (const auto& itr : mapr) { @@ -174,7 +174,7 @@ class EmitXmlFileVisitor final : public VNVisitor { } puts("\n"); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { outputTag(nodep, ""); puts(" origName="); putsQuoted(nodep->origName()); @@ -184,7 +184,7 @@ class EmitXmlFileVisitor final : public VNVisitor { if (nodep->modPublic()) puts(" public=\"true\""); outputChildrenEnd(nodep, ""); } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { const VVarType typ = nodep->varType(); const string kw = nodep->verilogKwd(); const string vt = nodep->dtypep()->name(); @@ -222,7 +222,7 @@ class EmitXmlFileVisitor final : public VNVisitor { if (nodep->attrSFormat()) puts(" sformat=\"true\""); outputChildrenEnd(nodep, ""); } - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { // What we call a pin in verilator is a port in the IEEE spec. outputTag(nodep, "port"); // IEEE: vpiPort if (nodep->modVarp()->isIO()) { @@ -232,12 +232,12 @@ class EmitXmlFileVisitor final : public VNVisitor { // Children includes vpiHighConn and vpiLowConn; we don't support port bits (yet?) outputChildrenEnd(nodep, "port"); } - virtual void visit(AstSenItem* nodep) override { + void visit(AstSenItem* nodep) override { outputTag(nodep, ""); puts(" edgeType=\"" + cvtToStr(nodep->edgeType().ascii()) + "\""); // IEEE vpiTopModule outputChildrenEnd(nodep, ""); } - virtual void visit(AstModportVarRef* nodep) override { + void visit(AstModportVarRef* nodep) override { // Dump direction for Modport references const string kw = nodep->direction().xmlKwd(); outputTag(nodep, ""); @@ -245,13 +245,13 @@ class EmitXmlFileVisitor final : public VNVisitor { putsQuoted(kw); outputChildrenEnd(nodep, ""); } - virtual void visit(AstVarXRef* nodep) override { + void visit(AstVarXRef* nodep) override { outputTag(nodep, ""); puts(" dotted="); putsQuoted(nodep->dotted()); outputChildrenEnd(nodep, ""); } - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { outputTag(nodep, ""); puts(" func="); putsQuoted(nodep->funcp()->name()); @@ -259,7 +259,7 @@ class EmitXmlFileVisitor final : public VNVisitor { } // Data types - virtual void visit(AstBasicDType* nodep) override { + void visit(AstBasicDType* nodep) override { outputTag(nodep, "basicdtype"); if (nodep->isRanged()) { puts(" left=\"" + cvtToStr(nodep->left()) + "\""); @@ -268,7 +268,7 @@ class EmitXmlFileVisitor final : public VNVisitor { if (nodep->isSigned()) { puts(" signed=\"true\""); } puts("/>\n"); } - virtual void visit(AstIfaceRefDType* nodep) override { + void visit(AstIfaceRefDType* nodep) override { string mpn; outputTag(nodep, ""); if (nodep->isModport()) mpn = nodep->modportName(); @@ -276,19 +276,19 @@ class EmitXmlFileVisitor final : public VNVisitor { putsQuoted(mpn); outputChildrenEnd(nodep, ""); } - virtual void visit(AstDisplay* nodep) override { + void visit(AstDisplay* nodep) override { outputTag(nodep, ""); puts(" displaytype="); putsQuoted(nodep->verilogKwd()); outputChildrenEnd(nodep, ""); } - virtual void visit(AstElabDisplay* nodep) override { + void visit(AstElabDisplay* nodep) override { outputTag(nodep, ""); puts(" displaytype="); putsQuoted(nodep->verilogKwd()); outputChildrenEnd(nodep, ""); } - virtual void visit(AstExtend* nodep) override { + void visit(AstExtend* nodep) override { outputTag(nodep, ""); puts(" width="); putsQuoted(cvtToStr(nodep->width())); @@ -296,7 +296,7 @@ class EmitXmlFileVisitor final : public VNVisitor { putsQuoted(cvtToStr(nodep->lhsp()->widthMinV())); outputChildrenEnd(nodep, ""); } - virtual void visit(AstExtendS* nodep) override { + void visit(AstExtendS* nodep) override { outputTag(nodep, ""); puts(" width="); putsQuoted(cvtToStr(nodep->width())); @@ -306,7 +306,7 @@ class EmitXmlFileVisitor final : public VNVisitor { } // Default - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { outputTag(nodep, ""); outputChildrenEnd(nodep, ""); } @@ -316,7 +316,7 @@ public: : m_ofp{ofp} { iterate(nodep); } - virtual ~EmitXmlFileVisitor() override = default; + ~EmitXmlFileVisitor() override = default; }; //###################################################################### @@ -333,11 +333,11 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Children are iterated backwards to ensure correct compilation order iterateChildrenBackwards(nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { // Only list modules and interfaces // Assumes modules and interfaces list is already sorted level wise if (!nodep->dead() && (VN_IS(nodep, Module) || VN_IS(nodep, Iface)) @@ -346,7 +346,7 @@ private: } } //----- - virtual void visit(AstNode*) override { + void visit(AstNode*) override { // All modules are present at root so no need to iterate on children } @@ -364,7 +364,7 @@ public: } m_os << "\n"; } - virtual ~ModuleFilesXmlVisitor() override = default; + ~ModuleFilesXmlVisitor() override = default; }; //###################################################################### @@ -381,9 +381,9 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITORS - virtual void visit(AstConstPool*) override {} + void visit(AstConstPool*) override {} - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { if (nodep->level() >= 0 && nodep->level() <= 2) { // ==2 because we don't add wrapper when in XML mode m_os << "\n"; @@ -402,7 +402,7 @@ private: m_os << "\n"; } } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { if (nodep->modp()->dead()) return; if (!m_hasChildren) m_os << ">\n"; m_os << "fileline()->xmlDetailedLocation() << " name=\"" << nodep->name() @@ -422,7 +422,7 @@ private: m_hasChildren = true; } //----- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -431,7 +431,7 @@ public: // Operate on whole netlist nodep->accept(*this); } - virtual ~HierCellsXmlVisitor() override = default; + ~HierCellsXmlVisitor() override = default; }; //###################################################################### diff --git a/src/V3Expand.cpp b/src/V3Expand.cpp index 6e8e2c1ec..85635e31a 100644 --- a/src/V3Expand.cpp +++ b/src/V3Expand.cpp @@ -313,7 +313,7 @@ private: } // VISITORS - virtual void visit(AstExtend* nodep) override { + void visit(AstExtend* nodep) override { if (nodep->user1SetOnce()) return; // Process once iterateChildren(nodep); if (nodep->isWide()) { @@ -339,7 +339,7 @@ private: } } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { if (nodep->user1SetOnce()) return; // Process once iterateChildren(nodep); // Remember, Sel's may have non-integer rhs, so need to optimize for that! @@ -628,7 +628,7 @@ private: } } - virtual void visit(AstConcat* nodep) override { + void visit(AstConcat* nodep) override { if (nodep->user1SetOnce()) return; // Process once iterateChildren(nodep); if (nodep->isWide()) { @@ -665,7 +665,7 @@ private: return true; } - virtual void visit(AstReplicate* nodep) override { + void visit(AstReplicate* nodep) override { if (nodep->user1SetOnce()) return; // Process once iterateChildren(nodep); if (nodep->isWide()) { @@ -750,10 +750,10 @@ private: VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep); } } - virtual void visit(AstEq* nodep) override { visitEqNeq(nodep); } - virtual void visit(AstNeq* nodep) override { visitEqNeq(nodep); } + void visit(AstEq* nodep) override { visitEqNeq(nodep); } + void visit(AstNeq* nodep) override { visitEqNeq(nodep); } - virtual void visit(AstRedOr* nodep) override { + void visit(AstRedOr* nodep) override { if (nodep->user1SetOnce()) return; // Process once iterateChildren(nodep); FileLine* const fl = nodep->fileline(); @@ -775,7 +775,7 @@ private: VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep); } } - virtual void visit(AstRedAnd* nodep) override { + void visit(AstRedAnd* nodep) override { if (nodep->user1SetOnce()) return; // Process once iterateChildren(nodep); FileLine* const fl = nodep->fileline(); @@ -805,7 +805,7 @@ private: VL_DO_DANGLING(replaceWithDelete(nodep, newp), nodep); } } - virtual void visit(AstRedXor* nodep) override { + void visit(AstRedXor* nodep) override { if (nodep->user1SetOnce()) return; // Process once iterateChildren(nodep); if (nodep->lhsp()->isWide()) { @@ -825,7 +825,7 @@ private: // which the inlined function does nicely. } - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { if (nodep->user1SetOnce()) return; // Process once if (!nodep->isStatement()) { iterateChildren(nodep); @@ -835,7 +835,7 @@ private: iterateChildren(nodep); m_stmtp = nullptr; } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { if (nodep->user1SetOnce()) return; // Process once m_stmtp = nodep; iterateChildren(nodep); @@ -876,13 +876,13 @@ private: } //-------------------- - virtual void visit(AstVar*) override {} // Don't hit varrefs under vars - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} // Don't hit varrefs under vars + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit ExpandVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~ExpandVisitor() override { + ~ExpandVisitor() override { V3Stats::addStat("Optimizations, expand wides", m_statWides); V3Stats::addStat("Optimizations, expand wide words", m_statWideWords); V3Stats::addStat("Optimizations, expand limited", m_statWideLimited); diff --git a/src/V3File.h b/src/V3File.h index 95b29eb8d..38f4dc6ff 100644 --- a/src/V3File.h +++ b/src/V3File.h @@ -206,7 +206,7 @@ public: V3OutFile(V3OutFile&&) = delete; V3OutFile& operator=(V3OutFile&&) = delete; - virtual ~V3OutFile() override; + ~V3OutFile() override; void putsForceIncs(); private: @@ -216,11 +216,11 @@ private: } // CALLBACKS - virtual void putcOutput(char chr) override { + void putcOutput(char chr) override { m_bufferp->at(m_usedBytes++) = chr; if (VL_UNLIKELY(m_usedBytes >= WRITE_BUFFER_SIZE_BYTES)) writeBlock(); } - virtual void putsOutput(const char* str) override { + void putsOutput(const char* str) override { std::size_t len = strlen(str); std::size_t availableBytes = WRITE_BUFFER_SIZE_BYTES - m_usedBytes; while (VL_UNLIKELY(len >= availableBytes)) { @@ -246,7 +246,7 @@ public: : V3OutFile{filename, V3OutFormatter::LA_C} { resetPrivate(); } - virtual ~V3OutCFile() override = default; + ~V3OutCFile() override = default; virtual void putsHeader() { puts("// Verilated -*- C++ -*-\n"); } virtual void putsIntTopInclude() { putsForceIncs(); } virtual void putsGuard(); @@ -270,9 +270,9 @@ class V3OutScFile final : public V3OutCFile { public: explicit V3OutScFile(const string& filename) : V3OutCFile{filename} {} - virtual ~V3OutScFile() override = default; - virtual void putsHeader() override { puts("// Verilated -*- SystemC -*-\n"); } - virtual void putsIntTopInclude() override { + ~V3OutScFile() override = default; + void putsHeader() override { puts("// Verilated -*- SystemC -*-\n"); } + void putsIntTopInclude() override { putsForceIncs(); puts("#include \"systemc.h\"\n"); puts("#include \"verilated_sc.h\"\n"); @@ -283,7 +283,7 @@ class V3OutVFile final : public V3OutFile { public: explicit V3OutVFile(const string& filename) : V3OutFile{filename, V3OutFormatter::LA_VERILOG} {} - virtual ~V3OutVFile() override = default; + ~V3OutVFile() override = default; virtual void putsHeader() { puts("// Verilated -*- Verilog -*-\n"); } }; @@ -293,7 +293,7 @@ public: : V3OutFile{filename, V3OutFormatter::LA_XML} { blockIndent(2); } - virtual ~V3OutXmlFile() override = default; + ~V3OutXmlFile() override = default; virtual void putsHeader() { puts("\n"); } }; @@ -301,7 +301,7 @@ class V3OutMkFile final : public V3OutFile { public: explicit V3OutMkFile(const string& filename) : V3OutFile{filename, V3OutFormatter::LA_MK} {} - virtual ~V3OutMkFile() override = default; + ~V3OutMkFile() override = default; virtual void putsHeader() { puts("# Verilated -*- Makefile -*-\n"); } // No automatic indentation yet. void puts(const char* strg) { putsNoTracking(strg); } diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index f7c9ed428..c65e1d3fe 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -79,9 +79,9 @@ public: GateEitherVertex(V3Graph* graphp, AstScope* scopep) : V3GraphVertex{graphp} , m_scopep{scopep} {} - virtual ~GateEitherVertex() override = default; + ~GateEitherVertex() override = default; // ACCESSORS - virtual string dotStyle() const override { return m_consumed ? "" : "dotted"; } + string dotStyle() const override { return m_consumed ? "" : "dotted"; } AstScope* scopep() const { return m_scopep; } bool reducible() const { return m_reducible; } bool dedupable() const { return m_dedupable; } @@ -137,11 +137,11 @@ public: GateVarVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp) : GateEitherVertex{graphp, scopep} , m_varScp{varScp} {} - virtual ~GateVarVertex() override = default; + ~GateVarVertex() override = default; // ACCESSORS AstVarScope* varScp() const { return m_varScp; } - virtual string name() const override { return (cvtToHex(m_varScp) + " " + varScp()->name()); } - virtual string dotColor() const override { return "blue"; } + string name() const override { return (cvtToHex(m_varScp) + " " + varScp()->name()); } + string dotColor() const override { return "blue"; } bool isTop() const { return m_isTop; } void setIsTop() { m_isTop = true; } bool isClock() const { return m_isClock; } @@ -162,7 +162,7 @@ public: setIsClock(); } } - virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) override { + VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) override { return v.visit(this, vu); } }; @@ -178,17 +178,15 @@ public: , m_nodep{nodep} , m_activep{activep} , m_slow{slow} {} - virtual ~GateLogicVertex() override = default; + ~GateLogicVertex() override = default; // ACCESSORS - virtual string name() const override { - return (cvtToHex(m_nodep) + "@" + scopep()->prettyName()); - } - virtual string dotColor() const override { return "purple"; } - virtual FileLine* fileline() const override { return nodep()->fileline(); } + string name() const override { return (cvtToHex(m_nodep) + "@" + scopep()->prettyName()); } + string dotColor() const override { return "purple"; } + FileLine* fileline() const override { return nodep()->fileline(); } AstNode* nodep() const { return m_nodep; } AstActive* activep() const { return m_activep; } bool slow() const { return m_slow; } - virtual VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) override { + VNUser accept(GateGraphBaseVisitor& v, VNUser vu = VNUser{0}) override { return v.visit(this, vu); } }; @@ -217,7 +215,7 @@ private: } } // VISITORS - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { ++m_ops; iterateChildren(nodep); // We only allow a LHS ref for the var being set, and a RHS ref for @@ -243,7 +241,7 @@ private: m_rhsVarRefs.push_back(nodep); } } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { m_substTreep = nodep->rhsp(); if (!VN_IS(nodep->lhsp(), NodeVarRef)) { clearSimple("ASSIGN(non-VARREF)"); @@ -264,7 +262,7 @@ private: } } //-------------------- - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { // *** Special iterator if (!m_isSimple) return; // Fastpath if (++m_ops > v3Global.opt.gateStmts()) clearSimple("--gate-stmts exceeded"); @@ -294,7 +292,7 @@ public: } if (debug() >= 9 && !m_isSimple) nodep->dumpTree(cout, " gate!Ok: "); } - virtual ~GateOkVisitor() override = default; + ~GateOkVisitor() override = default; // PUBLIC METHODS bool isSimple() const { return m_isSimple; } AstNode* substTree() const { return m_substTreep; } @@ -413,7 +411,7 @@ private: void decomposeClkVectors(); // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { iterateChildren(nodep); // if (debug() > 6) m_graph.dump(); if (debug() > 6) m_graph.dumpDotFilePrefixed("gate_pre"); @@ -445,7 +443,7 @@ private: // Rewrite assignments consumedMove(); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); { m_modp = nodep; @@ -453,14 +451,14 @@ private: iterateChildren(nodep); } } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { UINFO(4, " SCOPE " << nodep << endl); m_scopep = nodep; m_logicVertexp = nullptr; iterateChildren(nodep); m_scopep = nullptr; } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { // Create required blocks and add to module UINFO(4, " BLOCK " << nodep << endl); m_activeReducible = !(nodep->hasClocked()); // Seq logic outputs aren't reducible @@ -471,7 +469,7 @@ private: m_activep = nullptr; m_activeReducible = true; } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { if (m_scopep) { UASSERT_OBJ(m_logicVertexp, nodep, "Var ref not under a logic block"); AstVarScope* const varscp = nodep->varScopep(); @@ -499,17 +497,17 @@ private: } } } - virtual void visit(AstAlwaysPublic* nodep) override { + void visit(AstAlwaysPublic* nodep) override { VL_RESTORER(m_inSlow); { m_inSlow = true; iterateNewStmt(nodep, "AlwaysPublic", nullptr); } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { iterateNewStmt(nodep, "User C Function", "User C Function"); } - virtual void visit(AstSenItem* nodep) override { + void visit(AstSenItem* nodep) override { m_inSenItem = true; if (m_logicVertexp) { // Already under logic; presumably a SenGate iterateChildren(nodep); @@ -518,7 +516,7 @@ private: } m_inSenItem = false; } - virtual void visit(AstNodeProcedure* nodep) override { + void visit(AstNodeProcedure* nodep) override { VL_RESTORER(m_inSlow); { m_inSlow = VN_IS(nodep, Initial) || VN_IS(nodep, Final); @@ -526,23 +524,23 @@ private: nullptr); } } - virtual void visit(AstAssignAlias* nodep) override { // + void visit(AstAssignAlias* nodep) override { // iterateNewStmt(nodep, nullptr, nullptr); } - virtual void visit(AstAssignW* nodep) override { // + void visit(AstAssignW* nodep) override { // iterateNewStmt(nodep, nullptr, nullptr); } - virtual void visit(AstCoverToggle* nodep) override { + void visit(AstCoverToggle* nodep) override { iterateNewStmt(nodep, "CoverToggle", "CoverToggle"); } - virtual void visit(AstTraceDecl* nodep) override { + void visit(AstTraceDecl* nodep) override { VL_RESTORER(m_inSlow); { m_inSlow = true; iterateNewStmt(nodep, "Tracing", "Tracing"); } } - virtual void visit(AstConcat* nodep) override { + void visit(AstConcat* nodep) override { UASSERT_OBJ(!(VN_IS(nodep->backp(), NodeAssign) && VN_AS(nodep->backp(), NodeAssign)->lhsp() == nodep), nodep, "Concat on LHS of assignment; V3Const should have deleted it"); @@ -550,7 +548,7 @@ private: } //-------------------- - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { iterateChildren(nodep); if (nodep->isOutputter() && m_logicVertexp) m_logicVertexp->setConsumed("outputter"); } @@ -558,7 +556,7 @@ private: public: // CONSTRUCTORS explicit GateVisitor(AstNode* nodep) { iterate(nodep); } - virtual ~GateVisitor() override { + ~GateVisitor() override { V3Stats::addStat("Optimizations, Gate sigs deleted", m_statSigs); V3Stats::addStat("Optimizations, Gate inputs replaced", m_statRefs); V3Stats::addStat("Optimizations, Gate sigs deduped", m_statDedupLogic); @@ -810,7 +808,7 @@ private: public: GateDedupeHash() = default; - virtual ~GateDedupeHash() override { + ~GateDedupeHash() override { if (v3Global.opt.debugCheck()) check(); } @@ -836,7 +834,7 @@ public: } // Callback from V3DupFinder::findDuplicate - virtual bool isSame(AstNode* node1p, AstNode* node2p) override { + bool isSame(AstNode* node1p, AstNode* node2p) override { // Assignment may have been hashReplaced, if so consider non-match (effectively removed) if (isReplaced(node1p) || isReplaced(node2p)) { // UINFO(9, "isSame hit on replaced "<<(void*)node1p<<" "<<(void*)node2p<elsesp()) { // we're under an always, this is the first IF, and there's no else @@ -945,16 +943,16 @@ private: } } - virtual void visit(AstComment*) override {} // NOP + void visit(AstComment*) override {} // NOP //-------------------- - virtual void visit(AstNode*) override { // + void visit(AstNode*) override { // m_dedupable = false; } public: // CONSTRUCTORS GateDedupeVarVisitor() = default; - virtual ~GateDedupeVarVisitor() override = default; + ~GateDedupeVarVisitor() override = default; // PUBLIC METHODS AstNodeVarRef* findDupe(AstNode* nodep, AstVarScope* consumerVarScopep, AstActive* activep) { m_assignp = nullptr; @@ -1043,7 +1041,7 @@ private: GateDedupeVarVisitor m_varVisitor; // Looks for a dupe of the logic int m_depth = 0; // Iteration depth - virtual VNUser visit(GateVarVertex* vvertexp, VNUser) override { + VNUser visit(GateVarVertex* vvertexp, VNUser) override { // Check that we haven't been here before if (m_depth > GATE_DEDUP_MAX_DEPTH) return VNUser{0}; // Break loops; before user2 set so hit this vertex later @@ -1105,7 +1103,7 @@ private: // Given iterated logic, starting at vu which was consumer's GateVarVertex // Returns a varref that has the same logic input; or nullptr if none - virtual VNUser visit(GateLogicVertex* lvertexp, VNUser vu) override { + VNUser visit(GateLogicVertex* lvertexp, VNUser vu) override { lvertexp->iterateInEdges(*this); const GateVarVertex* const consumerVvertexpp @@ -1185,7 +1183,7 @@ private: } } - virtual VNUser visit(GateVarVertex* vvertexp, VNUser) override { + VNUser visit(GateVarVertex* vvertexp, VNUser) override { for (V3GraphEdge* edgep = vvertexp->inBeginp(); edgep;) { V3GraphEdge* oldedgep = edgep; edgep = edgep->inNextp(); // for recursive since the edge could be deleted @@ -1259,7 +1257,7 @@ private: } return VNUser{0}; } - virtual VNUser visit(GateLogicVertex*, VNUser) override { // + VNUser visit(GateLogicVertex*, VNUser) override { // return VNUser{0}; } @@ -1297,7 +1295,7 @@ private: bool m_found = false; // Offset found // VISITORS - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { UINFO(9, "CLK DECOMP Concat search var (off = " << m_offset << ") - " << nodep << endl); if (nodep->varScopep() == m_vscp && !nodep->user2() && !m_found) { // A concatenation may use the same var multiple times @@ -1309,18 +1307,18 @@ private: } m_offset += nodep->dtypep()->width(); } - virtual void visit(AstConcat* nodep) override { + void visit(AstConcat* nodep) override { UINFO(9, "CLK DECOMP Concat search (off = " << m_offset << ") - " << nodep << endl); iterate(nodep->rhsp()); iterate(nodep->lhsp()); } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS GateConcatVisitor() = default; - virtual ~GateConcatVisitor() override = default; + ~GateConcatVisitor() override = default; // PUBLIC METHODS bool concatOffset(AstConcat* concatp, AstVarScope* vscp, int& offsetr) { m_vscp = vscp; @@ -1360,7 +1358,7 @@ private: int m_total_seen_clk_vectors = 0; int m_total_decomposed_clk_vectors = 0; - virtual VNUser visit(GateVarVertex* vvertexp, VNUser vu) override { + VNUser visit(GateVarVertex* vvertexp, VNUser vu) override { // Check that we haven't been here before AstVarScope* const vsp = vvertexp->varScp(); if (vsp->user2SetOnce()) return VNUser{0}; @@ -1377,7 +1375,7 @@ private: return VNUser{0}; // Unused } - virtual VNUser visit(GateLogicVertex* lvertexp, VNUser vu) override { + VNUser visit(GateLogicVertex* lvertexp, VNUser vu) override { const GateClkDecompState* const currState = reinterpret_cast(vu.c()); int clk_offset = currState->m_offset; if (const AstAssignW* const assignp = VN_CAST(lvertexp->nodep(), AssignW)) { @@ -1444,7 +1442,7 @@ private: public: explicit GateClkDecompGraphVisitor(V3Graph* graphp) : GateGraphBaseVisitor{graphp} {} - virtual ~GateClkDecompGraphVisitor() override { + ~GateClkDecompGraphVisitor() override { V3Stats::addStat("Optimizations, Clocker seen vectors", m_total_seen_clk_vectors); V3Stats::addStat("Optimizations, Clocker decomposed vectors", m_total_decomposed_clk_vectors); diff --git a/src/V3GenClk.cpp b/src/V3GenClk.cpp index dd3985b6f..40327384b 100644 --- a/src/V3GenClk.cpp +++ b/src/V3GenClk.cpp @@ -90,7 +90,7 @@ private: } // VISITORS - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { // Consumption/generation of a variable, if (m_activep && !nodep->user3SetOnce()) { AstVarScope* const vscp = nodep->varScopep(); @@ -105,14 +105,14 @@ private: } } } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { m_activep = nodep; iterate(nodep->sensesp()); m_activep = nullptr; } //----- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -120,7 +120,7 @@ public: : m_topModp{topModp} { iterate(nodep); } - virtual ~GenClkRenameVisitor() override = default; + ~GenClkRenameVisitor() override = default; }; //###################################################################### @@ -139,7 +139,7 @@ private: AstNodeModule* m_topModp = nullptr; // Top module // VISITORS - virtual void visit(AstTopScope* nodep) override { + void visit(AstTopScope* nodep) override { { const VNUser1InUse user1InUse; iterateChildren(nodep); @@ -148,14 +148,14 @@ private: // See rename, it does some AstNode::userClearTree()'s GenClkRenameVisitor{nodep, m_topModp}; } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { // Only track the top scopes, not lower level functions if (nodep->isTop()) { m_topModp = nodep; iterateChildren(nodep); } } - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { iterateChildren(nodep); if (!nodep->funcp()->entryPoint()) { // Enter the function and trace it @@ -163,7 +163,7 @@ private: iterate(nodep->funcp()); } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { if (!m_tracingCall && !nodep->entryPoint()) { // Only consider logic within a CFunc when looking // at the call to it, and not when scanning whatever @@ -175,7 +175,7 @@ private: } //---- - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { // Consumption/generation of a variable, AstVarScope* const vscp = nodep->varScopep(); UASSERT_OBJ(vscp, nodep, "Scope not assigned"); @@ -190,13 +190,13 @@ private: vscp->circular(true); } } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { // UINFO(8, "ASS " << nodep << endl); m_assignp = nodep; iterateChildren(nodep); m_assignp = nullptr; } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { UINFO(8, "ACTIVE " << nodep << endl); m_activep = nodep; UASSERT_OBJ(nodep->sensesp(), nodep, "Unlinked"); @@ -206,13 +206,13 @@ private: } //----- - virtual void visit(AstVar*) override {} // Don't want varrefs under it - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} // Don't want varrefs under it + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit GenClkReadVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~GenClkReadVisitor() override = default; + ~GenClkReadVisitor() override = default; }; //###################################################################### diff --git a/src/V3GraphAcyc.cpp b/src/V3GraphAcyc.cpp index 0df758ed1..00ab8564f 100644 --- a/src/V3GraphAcyc.cpp +++ b/src/V3GraphAcyc.cpp @@ -42,13 +42,13 @@ public: GraphAcycVertex(V3Graph* graphp, V3GraphVertex* origVertexp) : V3GraphVertex{graphp} , m_origVertexp{origVertexp} {} - virtual ~GraphAcycVertex() override = default; + ~GraphAcycVertex() override = default; V3GraphVertex* origVertexp() const { return m_origVertexp; } void setDelete() { m_deleted = true; } bool isDelete() const { return m_deleted; } - virtual string name() const override { return m_origVertexp->name(); } - virtual string dotColor() const override { return m_origVertexp->dotColor(); } - virtual FileLine* fileline() const override { return m_origVertexp->fileline(); } + string name() const override { return m_origVertexp->name(); } + string dotColor() const override { return m_origVertexp->dotColor(); } + FileLine* fileline() const override { return m_origVertexp->fileline(); } }; //-------------------------------------------------------------------- @@ -67,11 +67,9 @@ public: GraphAcycEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top, int weight, bool cutable = false) : V3GraphEdge{graphp, fromp, top, weight, cutable} {} - virtual ~GraphAcycEdge() override = default; + ~GraphAcycEdge() override = default; // yellow=we might still cut it, else oldEdge: yellowGreen=made uncutable, red=uncutable - virtual string dotColor() const override { - return (cutable() ? "yellow" : origEdgep()->dotColor()); - } + string dotColor() const override { return (cutable() ? "yellow" : origEdgep()->dotColor()); } }; //-------------------------------------------------------------------- diff --git a/src/V3GraphTest.cpp b/src/V3GraphTest.cpp index 757c7ff70..40f847e0e 100644 --- a/src/V3GraphTest.cpp +++ b/src/V3GraphTest.cpp @@ -56,18 +56,18 @@ public: V3GraphTestVertex(V3Graph* graphp, const string& name) : V3GraphVertex{graphp} , m_name{name} {} - virtual ~V3GraphTestVertex() override = default; + ~V3GraphTestVertex() override = default; // ACCESSORS - virtual string name() const override { return m_name; } + string name() const override { return m_name; } }; class V3GraphTestVarVertex final : public V3GraphTestVertex { public: V3GraphTestVarVertex(V3Graph* graphp, const string& name) : V3GraphTestVertex{graphp, name} {} - virtual ~V3GraphTestVarVertex() override = default; + ~V3GraphTestVarVertex() override = default; // ACCESSORS - virtual string dotColor() const override { return "blue"; } + string dotColor() const override { return "blue"; } }; //###################################################################### @@ -76,8 +76,8 @@ public: class V3GraphTestStrong final : public V3GraphTest { public: - virtual string name() override { return "strong"; } - virtual void runTest() override { + string name() override { return "strong"; } + void runTest() override { V3Graph* gp = &m_graph; // Verify we break edges at a good point // A simple alg would make 3 breaks, below only requires b->i to break @@ -114,8 +114,8 @@ public: class V3GraphTestAcyc final : public V3GraphTest { public: - virtual string name() override { return "acyc"; } - virtual void runTest() override { + string name() override { return "acyc"; } + void runTest() override { V3Graph* gp = &m_graph; // Verify we break edges at a good point // A simple alg would make 3 breaks, below only requires b->i to break @@ -142,8 +142,8 @@ public: class V3GraphTestVars final : public V3GraphTest { public: - virtual string name() override { return "vars"; } - virtual void runTest() override { + string name() override { return "vars"; } + void runTest() override { V3Graph* gp = &m_graph; V3GraphTestVertex* clk = new V3GraphTestVarVertex(gp, "$clk"); @@ -268,8 +268,8 @@ class V3GraphTestImport final : public V3GraphTest { #endif public: - virtual string name() override { return "import"; } - virtual void runTest() override { + string name() override { return "import"; } + void runTest() override { V3Graph* const gp = &m_graph; dotImport(); dump(); diff --git a/src/V3Hasher.cpp b/src/V3Hasher.cpp index 53a276c89..7a2f7d78d 100644 --- a/src/V3Hasher.cpp +++ b/src/V3Hasher.cpp @@ -80,7 +80,7 @@ private: //------------------------------------------------------------ // AstNode - Warns to help find missing cases - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { #if VL_DEBUG UINFO(0, "%Warning: Hashing node as AstNode: " << nodep << endl); #endif @@ -89,93 +89,93 @@ private: //------------------------------------------------------------ // AstNodeDType - virtual void visit(AstNodeArrayDType* nodep) override { + void visit(AstNodeArrayDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { iterateNull(nodep->virtRefDTypep()); m_hash += nodep->left(); m_hash += nodep->right(); }); } - virtual void visit(AstNodeUOrStructDType* nodep) override { + void visit(AstNodeUOrStructDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, false, [=]() { // m_hash += nodep->uniqueNum(); }); } - virtual void visit(AstParamTypeDType* nodep) override { + void visit(AstParamTypeDType* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { m_hash += nodep->name(); m_hash += nodep->varType(); }); } - virtual void visit(AstMemberDType* nodep) override { + void visit(AstMemberDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); } - virtual void visit(AstDefImplicitDType* nodep) override { + void visit(AstDefImplicitDType* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->uniqueNum(); }); } - virtual void visit(AstAssocArrayDType* nodep) override { + void visit(AstAssocArrayDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { iterateNull(nodep->virtRefDTypep()); iterateNull(nodep->virtRefDType2p()); }); } - virtual void visit(AstDynArrayDType* nodep) override { + void visit(AstDynArrayDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // iterateNull(nodep->virtRefDTypep()); }); } - virtual void visit(AstUnsizedArrayDType* nodep) override { + void visit(AstUnsizedArrayDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // iterateNull(nodep->virtRefDTypep()); }); } - virtual void visit(AstWildcardArrayDType* nodep) override { + void visit(AstWildcardArrayDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // iterateNull(nodep->virtRefDTypep()); }); } - virtual void visit(AstBasicDType* nodep) override { + void visit(AstBasicDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { m_hash += nodep->keyword(); m_hash += nodep->nrange().left(); m_hash += nodep->nrange().right(); }); } - virtual void visit(AstConstDType* nodep) override { + void visit(AstConstDType* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // iterateNull(nodep->virtRefDTypep()); }); } - virtual void visit(AstClassRefDType* nodep) override { + void visit(AstClassRefDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // iterateNull(nodep->classp()); }); } - virtual void visit(AstIfaceRefDType* nodep) override { + void visit(AstIfaceRefDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // iterateNull(nodep->cellp()); }); } - virtual void visit(AstQueueDType* nodep) override { + void visit(AstQueueDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // iterateNull(nodep->virtRefDTypep()); }); } - virtual void visit(AstRefDType* nodep) override { + void visit(AstRefDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { m_hash += nodep->name(); iterateNull(nodep->typedefp()); iterateNull(nodep->refDTypep()); }); } - virtual void visit(AstVoidDType* nodep) override { + void visit(AstVoidDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstEnumDType* nodep) override { + void visit(AstEnumDType* nodep) override { m_hash += hashNodeAndIterate(nodep, false, false, [=]() { // m_hash += nodep->uniqueNum(); }); @@ -183,23 +183,23 @@ private: //------------------------------------------------------------ // AstNodeMath - virtual void visit(AstNodeMath* nodep) override { + void visit(AstNodeMath* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->num().toHash(); }); } - virtual void visit(AstNullCheck* nodep) override { + void visit(AstNullCheck* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstCCast* nodep) override { + void visit(AstCCast* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->size(); }); } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { if (nodep->varScopep()) { iterateNull(nodep->varScopep()); @@ -209,28 +209,28 @@ private: } }); } - virtual void visit(AstVarXRef* nodep) override { + void visit(AstVarXRef* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { iterateNull(nodep->varp()); m_hash += nodep->dotted(); }); } - virtual void visit(AstMemberSel* nodep) override { + void visit(AstMemberSel* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); } - virtual void visit(AstFScanF* nodep) override { + void visit(AstFScanF* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->text(); }); } - virtual void visit(AstSScanF* nodep) override { + void visit(AstSScanF* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->text(); }); } - virtual void visit(AstAddrOfCFunc* nodep) override { + void visit(AstAddrOfCFunc* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // iterateNull(nodep->funcp()); }); @@ -238,56 +238,56 @@ private: //------------------------------------------------------------ // AstNodeStmt - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstNodeText* nodep) override { + void visit(AstNodeText* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // m_hash += nodep->text(); }); } - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // iterateNull(nodep->funcp()); }); } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { iterateNull(nodep->taskp()); iterateNull(nodep->classOrPackagep()); }); } - virtual void visit(AstCMethodHard* nodep) override { + void visit(AstCMethodHard* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); } - virtual void visit(AstCoverInc* nodep) override { + void visit(AstCoverInc* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // iterateNull(nodep->declp()); }); } - virtual void visit(AstDisplay* nodep) override { + void visit(AstDisplay* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // m_hash += nodep->displayType(); }); } - virtual void visit(AstMonitorOff* nodep) override { + void visit(AstMonitorOff* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // m_hash += nodep->off(); }); } - virtual void visit(AstJumpGo* nodep) override { + void visit(AstJumpGo* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // iterateNull(nodep->labelp()); }); } - virtual void visit(AstTraceInc* nodep) override { + void visit(AstTraceInc* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // iterateNull(nodep->declp()); }); } - virtual void visit(AstNodeCoverOrAssert* nodep) override { + void visit(AstNodeCoverOrAssert* nodep) override { m_hash += hashNodeAndIterate(nodep, false, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); @@ -295,62 +295,62 @@ private: //------------------------------------------------------------ // AstNode direct descendents - virtual void visit(AstNodeRange* nodep) override { + void visit(AstNodeRange* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, false, [=]() { // m_hash += nodep->origName(); }); } - virtual void visit(AstNodePreSel* nodep) override { + void visit(AstNodePreSel* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstClassExtends* nodep) override { + void visit(AstClassExtends* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstSelLoopVars* nodep) override { + void visit(AstSelLoopVars* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstDefParam* nodep) override { + void visit(AstDefParam* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstArg* nodep) override { + void visit(AstArg* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstParseRef* nodep) override { + void visit(AstParseRef* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { m_hash += nodep->expect(); m_hash += nodep->name(); }); } - virtual void visit(AstClassOrPackageRef* nodep) override { + void visit(AstClassOrPackageRef* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // iterateNull(nodep->classOrPackageNodep()); }); } - virtual void visit(AstSenItem* nodep) override { + void visit(AstSenItem* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->edgeType(); }); } - virtual void visit(AstSenTree* nodep) override { + void visit(AstSenTree* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstSFormatF* nodep) override { + void visit(AstSFormatF* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->text(); }); } - virtual void visit(AstElabDisplay* nodep) override { + void visit(AstElabDisplay* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->displayType(); }); } - virtual void visit(AstInitItem* nodep) override { + void visit(AstInitItem* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstInitArray* nodep) override { + void visit(AstInitArray* nodep) override { if (const AstAssocArrayDType* const dtypep = VN_CAST(nodep->dtypep(), AssocArrayDType)) { if (nodep->defaultp()) { m_hash @@ -376,22 +376,22 @@ private: }); } } - virtual void visit(AstPragma* nodep) override { + void visit(AstPragma* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->pragType(); }); } - virtual void visit(AstAttrOf* nodep) override { + void visit(AstAttrOf* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->attrType(); }); } - virtual void visit(AstNodeFile* nodep) override { + void visit(AstNodeFile* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // // We might be in a recursive function, if so on *second* call // here we need to break what would be an infinite loop. @@ -402,90 +402,90 @@ private: m_hash += nodep->isLoose(); }); } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { m_hash += nodep->name(); m_hash += nodep->varType(); }); } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, false, [=]() { m_hash += nodep->name(); iterateNull(nodep->aboveScopep()); }); } - virtual void visit(AstVarScope* nodep) override { + void visit(AstVarScope* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { iterateNull(nodep->varp()); iterateNull(nodep->scopep()); }); } - virtual void visit(AstEnumItem* nodep) override { + void visit(AstEnumItem* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); } - virtual void visit(AstTypedef* nodep) override { + void visit(AstTypedef* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); } - virtual void visit(AstTypedefFwd* nodep) override { + void visit(AstTypedefFwd* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // iterateNull(nodep->sensesp()); }); } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { m_hash += nodep->name(); iterateNull(nodep->modp()); }); } - virtual void visit(AstCellInline* nodep) override { + void visit(AstCellInline* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { m_hash += nodep->name(); iterateNull(nodep->scopep()); }); } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); } - virtual void visit(AstModport* nodep) override { + void visit(AstModport* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); } - virtual void visit(AstModportVarRef* nodep) override { + void visit(AstModportVarRef* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { m_hash += nodep->name(); iterateNull(nodep->varp()); }); } - virtual void visit(AstModportFTaskRef* nodep) override { + void visit(AstModportFTaskRef* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { m_hash += nodep->name(); iterateNull(nodep->ftaskp()); }); } - virtual void visit(AstMTaskBody* nodep) override { + void visit(AstMTaskBody* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstNodeProcedure* nodep) override { + void visit(AstNodeProcedure* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() {}); } - virtual void visit(AstNodeBlock* nodep) override { + void visit(AstNodeBlock* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { // m_hash += nodep->name(); }); } - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { m_hash += hashNodeAndIterate(nodep, HASH_DTYPE, HASH_CHILDREN, [=]() { m_hash += nodep->name(); m_hash += nodep->pinNum(); @@ -504,7 +504,7 @@ public: iterate(const_cast(nodep)); } V3Hash finalHash() const { return m_hash; } - virtual ~HasherVisitor() override = default; + ~HasherVisitor() override = default; }; //###################################################################### diff --git a/src/V3HierBlock.cpp b/src/V3HierBlock.cpp index e7ac8dd9b..7a1b07057 100644 --- a/src/V3HierBlock.cpp +++ b/src/V3HierBlock.cpp @@ -250,7 +250,7 @@ class HierBlockUsageCollectVisitor final : public VNVisitor { ModuleSet m_referred; // Modules that have hier_block pragma V3HierBlock::GParams m_gparams; // list of variables that is VVarType::GPARAM - virtual void visit(AstModule* nodep) override { + void visit(AstModule* nodep) override { // Don't visit twice if (nodep->user1SetOnce()) return; UINFO(5, "Checking " << nodep->prettyNameQ() << " from " @@ -277,7 +277,7 @@ class HierBlockUsageCollectVisitor final : public VNVisitor { } m_gparams = prevGParams; } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { // Visit used module here to know that the module is hier_block or not. // This visitor behaves almost depth first search if (AstModule* const modp = VN_CAST(nodep->modp(), Module)) { @@ -287,15 +287,15 @@ class HierBlockUsageCollectVisitor final : public VNVisitor { // Nothing to do for interface because hierarchical block does not exist // beyond interface. } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { if (m_modp && m_modp->hierBlock() && nodep->isIfaceRef() && !nodep->isIfaceParent()) { nodep->v3error("Modport cannot be used at the hierarchical block boundary"); } if (nodep->isGParam() && nodep->overriddenParam()) m_gparams.push_back(nodep); } - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: HierBlockUsageCollectVisitor(V3HierBlockPlan* planp, AstNetlist* netlist) diff --git a/src/V3Inline.cpp b/src/V3Inline.cpp index 40f54dcce..277531647 100644 --- a/src/V3Inline.cpp +++ b/src/V3Inline.cpp @@ -112,7 +112,7 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { UASSERT_OBJ(!m_modp, nodep, "Unsupported: Nested modules"); m_modp = nodep; m_allMods.push_back(nodep); @@ -130,19 +130,19 @@ private: iterateChildren(nodep); m_modp = nullptr; } - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { // TODO allow inlining of modules that have classes // (Probably wait for new inliner scheme) cantInline("class", true); iterateChildren(nodep); } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { m_moduleState(nodep->modp()).m_cellRefs++; m_moduleState(m_modp).m_childCells.push_back(nodep); m_instances[m_modp][nodep->modp()]++; iterateChildren(nodep); } - virtual void visit(AstPragma* nodep) override { + void visit(AstPragma* nodep) override { if (nodep->pragType() == VPragmaType::INLINE_MODULE) { if (!m_modp) { nodep->v3error("Inline pragma not under a module"); // LCOV_EXCL_LINE @@ -162,28 +162,28 @@ private: VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } } - virtual void visit(AstVarXRef* nodep) override { + void visit(AstVarXRef* nodep) override { // Remove link. V3LinkDot will reestablish it after inlining. nodep->varp(nullptr); } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { // Remove link. V3LinkDot will reestablish it after inlining. // MethodCalls not currently supported by inliner, so keep linked if (!nodep->classOrPackagep() && !VN_IS(nodep, MethodCall)) nodep->taskp(nullptr); iterateChildren(nodep); } - virtual void visit(AstAlways* nodep) override { + void visit(AstAlways* nodep) override { m_modp->user4Inc(); // statement count iterateChildren(nodep); } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { // Don't count assignments, as they'll likely flatten out // Still need to iterate though to nullify VarXRefs const int oldcnt = m_modp->user4(); iterateChildren(nodep); m_modp->user4(oldcnt); } - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Build ModuleState, user2, and user4 for all modules. // Also build m_allMods and m_instances. iterateChildren(nodep); @@ -226,7 +226,7 @@ private: } } //-------------------- - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { if (m_modp) m_modp->user4Inc(); // Inc statement count iterateChildren(nodep); } @@ -237,7 +237,7 @@ public: : m_moduleState{moduleState} { iterate(nodep); } - virtual ~InlineMarkVisitor() override { + ~InlineMarkVisitor() override { V3Stats::addStat("Optimizations, Inline unsupported", m_statUnsup); } }; @@ -260,7 +260,7 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITORS - virtual void visit(AstCellInline* nodep) override { + void visit(AstCellInline* nodep) override { // Inlined cell under the inline cell, need to move to avoid conflicts nodep->unlinkFrBack(); m_modp->addInlinesp(nodep); @@ -270,20 +270,20 @@ private: // Do CellInlines under this, but don't move them iterateChildren(nodep); } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { // Cell under the inline cell, need to rename to avoid conflicts nodep->name(m_cellp->name() + "__DOT__" + nodep->name()); iterateChildren(nodep); } - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { nodep->name(m_cellp->name() + "__DOT__" + nodep->name()); iterateChildren(nodep); } - virtual void visit(AstModule* nodep) override { + void visit(AstModule* nodep) override { m_renamedInterfaces.clear(); iterateChildren(nodep); } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { if (nodep->user2p()) { // Make an assignment, so we'll trace it properly // user2p is either a const or a var. @@ -360,17 +360,17 @@ private: if (debug() >= 9) nodep->dumpTree(cout, "varchanged:"); if (debug() >= 9 && nodep->valuep()) nodep->valuep()->dumpTree(cout, "varchangei:"); } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { // Function under the inline cell, need to rename to avoid conflicts nodep->name(m_cellp->name() + "__DOT__" + nodep->name()); iterateChildren(nodep); } - virtual void visit(AstTypedef* nodep) override { + void visit(AstTypedef* nodep) override { // Typedef under the inline cell, need to rename to avoid conflicts nodep->name(m_cellp->name() + "__DOT__" + nodep->name()); iterateChildren(nodep); } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (nodep->varp()->user2p() // It's being converted to an alias. && !nodep->varp()->user3() // Don't constant propagate aliases (we just made) @@ -388,7 +388,7 @@ private: } nodep->name(nodep->varp()->name()); } - virtual void visit(AstVarXRef* nodep) override { + void visit(AstVarXRef* nodep) override { // Track what scope it was originally under so V3LinkDot can resolve it nodep->inlinedDots(VString::dot(m_cellp->name(), ".", nodep->inlinedDots())); for (string tryname = nodep->dotted(); true;) { @@ -406,7 +406,7 @@ private: } iterateChildren(nodep); } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { // Track what scope it was originally under so V3LinkDot can resolve it nodep->inlinedDots(VString::dot(m_cellp->name(), ".", nodep->inlinedDots())); if (m_renamedInterfaces.count(nodep->dotted())) { @@ -417,9 +417,9 @@ private: } // Not needed, as V3LinkDot doesn't care about typedefs - // virtual void visit(AstRefDType* nodep) override {} + // void visit(AstRefDType* nodep) override {} - virtual void visit(AstScopeName* nodep) override { + void visit(AstScopeName* nodep) override { // If there's a %m in the display text, we add a special node that will contain the name() // Similar code in V3Begin // To keep correct visual order, must add before other Text's @@ -435,12 +435,12 @@ private: if (afterp) nodep->scopeEntrp(afterp); iterateChildren(nodep); } - virtual void visit(AstCoverDecl* nodep) override { + void visit(AstCoverDecl* nodep) override { // Fix path in coverage statements nodep->hier(VString::dot(m_cellp->prettyName(), ".", nodep->hier())); iterateChildren(nodep); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -449,7 +449,7 @@ public: , m_cellp{cellp} { iterate(cloneModp); } - virtual ~InlineRelinkVisitor() override = default; + ~InlineRelinkVisitor() override = default; }; //###################################################################### @@ -576,13 +576,13 @@ private: } // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Iterate modules backwards, in bottom-up order. Required! iterateAndNextConstNullBackwards(nodep->modulesp()); // Clean up AstIfaceRefDType references iterateChildren(nodep->typeTablep()); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { UASSERT_OBJ(!m_modp, nodep, "Unsupported: Nested modules"); m_modp = nodep; // Iterate the stored cells directly to reduce traversal @@ -592,7 +592,7 @@ private: m_moduleState(nodep).m_childCells.clear(); m_modp = nullptr; } - virtual void visit(AstIfaceRefDType* nodep) override { + void visit(AstIfaceRefDType* nodep) override { if (nodep->user5()) { // The cell has been removed so let's make sure we don't leave a reference to it // This dtype may still be in use by the AstAssignVarScope created earlier @@ -602,15 +602,15 @@ private: } //-------------------- - virtual void visit(AstCell* nodep) override { // LCOV_EXCL_START + void visit(AstCell* nodep) override { // LCOV_EXCL_START nodep->v3fatal("Traversal should have been short circuited"); } - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { nodep->v3fatal("Traversal should have been short circuited"); } // LCOV_EXCL_STOP - virtual void visit(AstNodeFile*) override {} // Accelerate - virtual void visit(AstNodeDType*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeFile*) override {} // Accelerate + void visit(AstNodeDType*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -618,7 +618,7 @@ public: : m_moduleState{moduleState} { iterate(nodep); } - virtual ~InlineVisitor() override { + ~InlineVisitor() override { V3Stats::addStat("Optimizations, Inlined instances", m_statCells); } }; @@ -639,8 +639,8 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITORS - virtual void visit(AstNetlist* nodep) override { iterateChildren(nodep->topModulep()); } - virtual void visit(AstCell* nodep) override { + void visit(AstNetlist* nodep) override { iterateChildren(nodep->topModulep()); } + void visit(AstCell* nodep) override { VL_RESTORER(m_scope); if (m_scope.empty()) { m_scope = nodep->name(); @@ -673,7 +673,7 @@ private: iterateChildren(modp); } } - virtual void visit(AstAssignVarScope* nodep) override { + void visit(AstAssignVarScope* nodep) override { // Reference const AstVarRef* const reflp = VN_CAST(nodep->lhsp(), VarRef); // What the reference refers to @@ -698,14 +698,14 @@ private: cellp->addIntfRefp(new AstIntfRef(varlp->fileline(), alias)); } //-------------------- - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstNodeStmt*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstNodeStmt*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit InlineIntfRefVisitor(AstNode* nodep) { iterate(nodep); } - virtual ~InlineIntfRefVisitor() override = default; + ~InlineIntfRefVisitor() override = default; }; //###################################################################### diff --git a/src/V3Inst.cpp b/src/V3Inst.cpp index e66936eec..adca8b9da 100644 --- a/src/V3Inst.cpp +++ b/src/V3Inst.cpp @@ -49,7 +49,7 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITORS - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { UINFO(4, " CELL " << nodep << endl); m_cellp = nodep; // VV***** We reset user1p() on each cell!!! @@ -57,7 +57,7 @@ private: iterateChildren(nodep); m_cellp = nullptr; } - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { // PIN(p,expr) -> ASSIGNW(VARXREF(p),expr) (if sub's input) // or ASSIGNW(expr,VARXREF(p)) (if sub's output) UINFO(4, " PIN " << nodep << endl); @@ -116,7 +116,7 @@ private: VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstUdpTable* nodep) override { + void visit(AstUdpTable* nodep) override { if (!v3Global.opt.bboxUnsup()) { // If we support primitives, update V3Undriven to remove special case nodep->v3warn(E_UNSUPPORTED, "Unsupported: Verilog 1995 UDP Tables. " @@ -125,17 +125,17 @@ private: } // Save some time - virtual void visit(AstNodeMath*) override {} - virtual void visit(AstNodeAssign*) override {} - virtual void visit(AstAlways*) override {} + void visit(AstNodeMath*) override {} + void visit(AstNodeAssign*) override {} + void visit(AstAlways*) override {} //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit InstVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~InstVisitor() override = default; + ~InstVisitor() override = default; }; //###################################################################### @@ -149,15 +149,15 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITORS - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { if (VN_IS(nodep->dtypep(), IfaceRefDType)) { UINFO(8, " dm-1-VAR " << nodep << endl); insert(nodep); } iterateChildren(nodep); } - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // METHODS @@ -181,7 +181,7 @@ public: // CONSTRUCTORS InstDeModVarVisitor() = default; - virtual ~InstDeModVarVisitor() override = default; + ~InstDeModVarVisitor() override = default; void main(AstNodeModule* nodep) { UINFO(8, " dmMODULE " << nodep << endl); m_modVarNameMap.clear(); @@ -203,7 +203,7 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITORS - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { if (VN_IS(nodep->dtypep(), UnpackArrayDType) && VN_IS(VN_AS(nodep->dtypep(), UnpackArrayDType)->subDTypep(), IfaceRefDType)) { UINFO(8, " dv-vec-VAR " << nodep << endl); @@ -239,7 +239,7 @@ private: iterateChildren(nodep); } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { UINFO(4, " CELL " << nodep << endl); // Find submodule vars UASSERT_OBJ(nodep->modp(), nodep, "Unlinked"); @@ -316,7 +316,7 @@ private: } } - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { // Any non-direct pins need reconnection with a part-select if (!nodep->exprp()) return; // No-connect if (m_cellRangep) { @@ -478,13 +478,13 @@ private: } //-------------------- - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit InstDeVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~InstDeVisitor() override = default; + ~InstDeVisitor() override = default; }; //###################################################################### diff --git a/src/V3InstrCount.cpp b/src/V3InstrCount.cpp index d0ec37562..41a0e9ef2 100644 --- a/src/V3InstrCount.cpp +++ b/src/V3InstrCount.cpp @@ -75,7 +75,7 @@ public: , m_osp{osp} { if (nodep) iterate(nodep); } - virtual ~InstrCountVisitor() override = default; + ~InstrCountVisitor() override = default; // METHODS uint32_t instrCount() const { return m_instrCount; } @@ -117,7 +117,7 @@ private: } // VISITORS - virtual void visit(AstNodeSel* nodep) override { + void visit(AstNodeSel* nodep) override { // This covers both AstArraySel and AstWordSel // // If some vector is a bazillion dwords long, and we're selecting 1 @@ -128,7 +128,7 @@ private: const VisitBase vb{this, nodep}; iterateAndNextNull(nodep->bitp()); } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { // Similar to AstNodeSel above, a small select into a large vector // is not expensive. Count the cost of the AstSel itself (scales with // its width) and the cost of the lsbp() and widthp() nodes, but not @@ -137,13 +137,13 @@ private: iterateAndNextNull(nodep->lsbp()); iterateAndNextNull(nodep->widthp()); } - virtual void visit(AstSliceSel* nodep) override { // LCOV_EXCL_LINE + void visit(AstSliceSel* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc("AstSliceSel unhandled"); } - virtual void visit(AstMemberSel* nodep) override { // LCOV_EXCL_LINE + void visit(AstMemberSel* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc("AstMemberSel unhandled"); } - virtual void visit(AstConcat* nodep) override { + void visit(AstConcat* nodep) override { // Nop. // // Ignore concat. The problem with counting concat is that when we @@ -163,7 +163,7 @@ private: // the widths of the operands (ignored here). markCost(nodep); } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { const VisitBase vb{this, nodep}; iterateAndNextNull(nodep->condp()); const uint32_t savedCount = m_instrCount; @@ -188,7 +188,7 @@ private: if (nodep->ifsp()) nodep->ifsp()->user4(0); // Don't dump it } } - virtual void visit(AstNodeCond* nodep) override { + void visit(AstNodeCond* nodep) override { // Just like if/else above, the ternary operator only evaluates // one of the two expressions, so only count the max. const VisitBase vb{this, nodep}; @@ -213,7 +213,7 @@ private: if (nodep->expr2p()) nodep->expr2p()->user4(0); // Don't dump it } } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { // You'd think that the OrderLogicVertex's would be disjoint trees // of stuff in the AST, but it isn't so: V3Order makes an // OrderLogicVertex for each ACTIVE, and then also makes an @@ -229,14 +229,14 @@ private: markCost(nodep); UASSERT_OBJ(nodep == m_startNodep, nodep, "Multiple actives, or not start node"); } - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { const VisitBase vb{this, nodep}; iterateChildren(nodep); m_tracingCall = true; iterate(nodep->funcp()); UASSERT_OBJ(!m_tracingCall, nodep, "visit(AstCFunc) should have cleared m_tracingCall."); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { // Don't count a CFunc other than by tracing a call or counting it // from the root UASSERT_OBJ(m_tracingCall || nodep == m_startNodep, nodep, @@ -249,7 +249,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { const VisitBase vb{this, nodep}; iterateChildren(nodep); } @@ -276,12 +276,12 @@ public: UASSERT_OBJ(osp, nodep, "Don't call if not dumping"); if (nodep) iterate(nodep); } - virtual ~InstrCountDumpVisitor() override = default; + ~InstrCountDumpVisitor() override = default; private: // METHODS string indent() const { return string(m_depth, ':') + " "; } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { ++m_depth; if (unsigned costPlus1 = nodep->user4()) { *m_osp << " " << indent() << "cost " << std::setw(6) << std::left << (costPlus1 - 1) diff --git a/src/V3Life.cpp b/src/V3Life.cpp index 482a4d301..d33a47291 100644 --- a/src/V3Life.cpp +++ b/src/V3Life.cpp @@ -291,7 +291,7 @@ private: } // VISITORS - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { // Consumption/generation of a variable, // it's used so can't elim assignment before this use. UASSERT_OBJ(nodep->varScopep(), nodep, "nullptr"); @@ -305,7 +305,7 @@ private: VL_DO_DANGLING(m_lifep->varUsageReplace(vscp, nodep), nodep); } } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { // Collect any used variables first, as lhs may also be on rhs // Similar code in V3Dead const uint64_t lastEdit = AstNode::editCountGbl(); // When it was last edited @@ -325,13 +325,13 @@ private: iterateAndNextNull(nodep->lhsp()); } } - virtual void visit(AstAssignDly* nodep) override { + void visit(AstAssignDly* nodep) override { // Don't treat as normal assign; V3Life doesn't understand time sense iterateChildren(nodep); } //---- Track control flow changes - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { UINFO(4, " IF " << nodep << endl); // Condition is part of PREVIOUS block iterateAndNextNull(nodep->condp()); @@ -357,7 +357,7 @@ private: VL_DO_DANGLING(delete elseLifep, elseLifep); } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { // While's are a problem, as we don't allow loops in the graph. We // may go around the cond/body multiple times. Thus a // lifelication just in the body is ok, but we can't delete an @@ -386,7 +386,7 @@ private: VL_DO_DANGLING(delete condLifep, condLifep); VL_DO_DANGLING(delete bodyLifep, bodyLifep); } - virtual void visit(AstJumpBlock* nodep) override { + void visit(AstJumpBlock* nodep) override { // As with While's we can't predict if a JumpGo will kill us or not // It's worse though as an IF(..., JUMPGO) may change the control flow. // Just don't optimize blocks with labels; they're rare - so far. @@ -404,7 +404,7 @@ private: bodyLifep->lifeToAbove(); VL_DO_DANGLING(delete bodyLifep, bodyLifep); } - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { // UINFO(4, " CCALL " << nodep << endl); iterateChildren(nodep); // Enter the function and trace it @@ -414,7 +414,7 @@ private: iterate(nodep->funcp()); } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { // UINFO(4, " CFUNC " << nodep << endl); if (!m_tracingCall && !nodep->entryPoint()) return; m_tracingCall = false; @@ -423,17 +423,17 @@ private: } iterateChildren(nodep); } - virtual void visit(AstUCFunc* nodep) override { + void visit(AstUCFunc* nodep) override { m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment iterateChildren(nodep); } - virtual void visit(AstCMath* nodep) override { + void visit(AstCMath* nodep) override { m_sideEffect = true; // If appears on assign RHS, don't ever delete the assignment iterateChildren(nodep); } - virtual void visit(AstVar*) override {} // Don't want varrefs under it - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} // Don't want varrefs under it + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -446,7 +446,7 @@ public: if (m_lifep) VL_DO_CLEAR(delete m_lifep, m_lifep = nullptr); } } - virtual ~LifeVisitor() override { + ~LifeVisitor() override { if (m_lifep) VL_DO_CLEAR(delete m_lifep, m_lifep = nullptr); } VL_UNCOPYABLE(LifeVisitor); @@ -462,20 +462,20 @@ private: LifeState* const m_statep; // Current state // VISITORS - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { if (nodep->entryPoint()) { // Usage model 1: Simulate all C code, doing lifetime analysis LifeVisitor{nodep, m_statep}; } } - virtual void visit(AstNodeProcedure* nodep) override { + void visit(AstNodeProcedure* nodep) override { // Usage model 2: Cleanup basic blocks LifeVisitor{nodep, m_statep}; } - virtual void visit(AstVar*) override {} // Accelerate - virtual void visit(AstNodeStmt*) override {} // Accelerate - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} // Accelerate + void visit(AstNodeStmt*) override {} // Accelerate + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -483,7 +483,7 @@ public: : m_statep{statep} { iterate(nodep); } - virtual ~LifeTopVisitor() override = default; + ~LifeTopVisitor() override = default; }; //###################################################################### diff --git a/src/V3LifePost.cpp b/src/V3LifePost.cpp index da18dec1b..ce750f4f8 100644 --- a/src/V3LifePost.cpp +++ b/src/V3LifePost.cpp @@ -54,7 +54,7 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITORS - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { const AstVarScope* const vscp = nodep->varScopep(); UASSERT_OBJ(vscp, nodep, "Scope not assigned"); if (AstVarScope* const newvscp = reinterpret_cast(vscp->user4p())) { @@ -64,11 +64,11 @@ private: VL_DO_DANGLING(nodep->deleteTree(), nodep); } } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { // Only track the top scopes, not lower level functions if (nodep->isTop()) iterateChildren(nodep); } - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { iterateChildren(nodep); if (!nodep->funcp()->entryPoint()) { // Enter the function and trace it @@ -76,23 +76,23 @@ private: iterate(nodep->funcp()); } } - virtual void visit(AstExecGraph* nodep) override { + void visit(AstExecGraph* nodep) override { // Can just iterate across the MTask bodies in any order. Order // isn't important for LifePostElimVisitor's simple substitution. iterateChildren(nodep); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { if (!m_tracingCall && !nodep->entryPoint()) return; m_tracingCall = false; iterateChildren(nodep); } - virtual void visit(AstVar*) override {} // Don't want varrefs under it - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} // Don't want varrefs under it + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit LifePostElimVisitor(AstTopScope* nodep) { iterate(nodep); } - virtual ~LifePostElimVisitor() override = default; + ~LifePostElimVisitor() override = default; }; //###################################################################### @@ -250,7 +250,7 @@ private: } // VISITORS - virtual void visit(AstTopScope* nodep) override { + void visit(AstTopScope* nodep) override { AstNode::user4ClearTree(); // user4p() used on entire tree // First, build maps of every location (mtask and sequence @@ -274,7 +274,7 @@ private: // Replace any node4p varscopes with the new scope LifePostElimVisitor{nodep}; } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { // Consumption/generation of a variable, const AstVarScope* const vscp = nodep->varScopep(); UASSERT_OBJ(vscp, nodep, "Scope not assigned"); @@ -283,14 +283,14 @@ private: if (nodep->access().isWriteOrRW()) m_writes[vscp].insert(loc); if (nodep->access().isReadOrRW()) m_reads[vscp].insert(loc); } - virtual void visit(AstAssignPre* nodep) override { + void visit(AstAssignPre* nodep) override { // Do not record varrefs within assign pre. // // The pre-assignment into the dly var should not count as its // first write; we only want to consider reads and writes that // would still happen if the dly var were eliminated. } - virtual void visit(AstAssignPost* nodep) override { + void visit(AstAssignPost* nodep) override { // Don't record ASSIGNPOST in the read/write maps, record them in a // separate map if (const AstVarRef* const rhsp = VN_CAST(nodep->rhsp(), VarRef)) { @@ -302,11 +302,11 @@ private: m_assignposts[dlyVarp] = LifePostLocation(loc, nodep); } } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { // Only track the top scopes, not lower level functions if (nodep->isTop()) iterateChildren(nodep); } - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { iterateChildren(nodep); if (!nodep->funcp()->entryPoint()) { // Enter the function and trace it @@ -314,7 +314,7 @@ private: iterate(nodep->funcp()); } } - virtual void visit(AstExecGraph* nodep) override { + void visit(AstExecGraph* nodep) override { // Treat the ExecGraph like a call to each mtask body UASSERT_OBJ(!m_mtasksGraphp, nodep, "Cannot handle more than one AstExecGraph"); m_mtasksGraphp = nodep->depGraphp(); @@ -327,19 +327,19 @@ private: } m_execMTaskp = nullptr; } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { if (!m_tracingCall && !nodep->entryPoint()) return; m_tracingCall = false; iterateChildren(nodep); } //----- - virtual void visit(AstVar*) override {} // Don't want varrefs under it - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} // Don't want varrefs under it + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit LifePostDlyVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~LifePostDlyVisitor() override { + ~LifePostDlyVisitor() override { V3Stats::addStat("Optimizations, Lifetime postassign deletions", m_statAssnDel); } }; diff --git a/src/V3LinkCells.cpp b/src/V3LinkCells.cpp index 03703c2c8..393013026 100644 --- a/src/V3LinkCells.cpp +++ b/src/V3LinkCells.cpp @@ -45,8 +45,8 @@ class LinkCellsGraph final : public V3Graph { public: LinkCellsGraph() = default; - virtual ~LinkCellsGraph() override = default; - virtual void loopsMessageCb(V3GraphVertex* vertexp) override; + ~LinkCellsGraph() override = default; + void loopsMessageCb(V3GraphVertex* vertexp) override; }; class LinkCellsVertex final : public V3GraphVertex { @@ -56,12 +56,12 @@ public: LinkCellsVertex(V3Graph* graphp, AstNodeModule* modp) : V3GraphVertex{graphp} , m_modp{modp} {} - virtual ~LinkCellsVertex() override = default; + ~LinkCellsVertex() override = default; AstNodeModule* modp() const { return m_modp; } - virtual string name() const override { return modp()->name(); } - virtual FileLine* fileline() const override { return modp()->fileline(); } + string name() const override { return modp()->name(); } + FileLine* fileline() const override { return modp()->fileline(); } // Recursive modules get space for maximum recursion - virtual uint32_t rankAdder() const override { + uint32_t rankAdder() const override { return m_modp->recursiveClone() ? (1 + v3Global.opt.moduleRecursionDepth()) : 1; } }; @@ -70,8 +70,8 @@ class LibraryVertex final : public V3GraphVertex { public: explicit LibraryVertex(V3Graph* graphp) : V3GraphVertex{graphp} {} - virtual ~LibraryVertex() override = default; - virtual string name() const override { return "*LIBRARY*"; } + ~LibraryVertex() override = default; + string name() const override { return "*LIBRARY*"; } }; void LinkCellsGraph::loopsMessageCb(V3GraphVertex* vertexp) { @@ -161,7 +161,7 @@ private: } // VISITs - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { AstNode::user1ClearTree(); readModNames(); iterateChildren(nodep); @@ -181,8 +181,8 @@ private: << "' was not found in design."); } } - virtual void visit(AstConstPool* nodep) override {} - virtual void visit(AstNodeModule* nodep) override { + void visit(AstConstPool* nodep) override {} + void visit(AstNodeModule* nodep) override { // Module: Pick up modnames, so we can resolve cells later VL_RESTORER(m_modp); { @@ -227,7 +227,7 @@ private: } } - virtual void visit(AstIfaceRefDType* nodep) override { + void visit(AstIfaceRefDType* nodep) override { // Cell: Resolve its filename. If necessary, parse it. UINFO(4, "Link IfaceRef: " << nodep << endl); // Use findIdUpward instead of findIdFlat; it doesn't matter for now @@ -246,14 +246,14 @@ private: // Note cannot do modport resolution here; modports are allowed underneath generates } - virtual void visit(AstPackageImport* nodep) override { + void visit(AstPackageImport* nodep) override { // Package Import: We need to do the package before the use of a package iterateChildren(nodep); UASSERT_OBJ(nodep->packagep(), nodep, "Unlinked package"); // Parser should set packagep new V3GraphEdge(&m_graph, vertex(m_modp), vertex(nodep->packagep()), 1, false); } - virtual void visit(AstBind* nodep) override { + void visit(AstBind* nodep) override { // Bind: Has cells underneath that need to be put into the new // module, and cells which need resolution // TODO this doesn't allow bind to dotted hier names, that would require @@ -275,7 +275,7 @@ private: pushDeletep(nodep->unlinkFrBack()); } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { // Cell: Resolve its filename. If necessary, parse it. // Execute only once. Complication is that cloning may result in // user1 being set (for pre-clone) so check if user1() matches the @@ -452,14 +452,14 @@ private: UINFO(4, " Link Cell done: " << nodep << endl); } - virtual void visit(AstRefDType* nodep) override { + void visit(AstRefDType* nodep) override { iterateChildren(nodep); for (AstPin* pinp = nodep->paramsp(); pinp; pinp = VN_AS(pinp->nextp(), Pin)) { pinp->param(true); if (pinp->name() == "") pinp->name("__paramNumber" + cvtToStr(pinp->pinNum())); } } - virtual void visit(AstClassOrPackageRef* nodep) override { + void visit(AstClassOrPackageRef* nodep) override { iterateChildren(nodep); // Inside a class, an extends or reference to another class // Note we don't add a V3GraphEdge{vertex(m_modp), vertex(nodep->classOrPackagep()} @@ -471,7 +471,7 @@ private: } } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } // METHODS void readModNames() { @@ -528,7 +528,7 @@ public: } iterate(nodep); } - virtual ~LinkCellsVisitor() override = default; + ~LinkCellsVisitor() override = default; }; //###################################################################### diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 6a85a0ff4..4168a0b83 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -81,25 +81,25 @@ class LinkNodeMatcherClass final : public VNodeMatcher { public: - virtual bool nodeMatch(const AstNode* nodep) const override { return VN_IS(nodep, Class); } + bool nodeMatch(const AstNode* nodep) const override { return VN_IS(nodep, Class); } }; class LinkNodeMatcherFTask final : public VNodeMatcher { public: - virtual bool nodeMatch(const AstNode* nodep) const override { return VN_IS(nodep, NodeFTask); } + bool nodeMatch(const AstNode* nodep) const override { return VN_IS(nodep, NodeFTask); } }; class LinkNodeMatcherModport final : public VNodeMatcher { public: - virtual bool nodeMatch(const AstNode* nodep) const override { return VN_IS(nodep, Modport); } + bool nodeMatch(const AstNode* nodep) const override { return VN_IS(nodep, Modport); } }; class LinkNodeMatcherVar final : public VNodeMatcher { public: - virtual bool nodeMatch(const AstNode* nodep) const override { + bool nodeMatch(const AstNode* nodep) const override { return VN_IS(nodep, Var) || VN_IS(nodep, LambdaArgRef); } }; class LinkNodeMatcherVarIO final : public VNodeMatcher { public: - virtual bool nodeMatch(const AstNode* nodep) const override { + bool nodeMatch(const AstNode* nodep) const override { const AstVar* const varp = VN_CAST(nodep, Var); if (!varp) return false; return varp->isIO(); @@ -107,7 +107,7 @@ public: }; class LinkNodeMatcherVarParam final : public VNodeMatcher { public: - virtual bool nodeMatch(const AstNode* nodep) const override { + bool nodeMatch(const AstNode* nodep) const override { const AstVar* const varp = VN_CAST(nodep, Var); if (!varp) return false; return varp->isParam(); @@ -742,7 +742,7 @@ class LinkDotFindVisitor final : public VNVisitor { } // VISITs - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Process $unit or other packages // Not needed - dotted references not allowed from inside packages // for (AstNodeModule* nodep = v3Global.rootp()->modulesp(); @@ -770,9 +770,9 @@ class LinkDotFindVisitor final : public VNVisitor { m_curSymp = m_modSymp = nullptr; } } - virtual void visit(AstTypeTable*) override {} - virtual void visit(AstConstPool*) override {} - virtual void visit(AstNodeModule* nodep) override { + void visit(AstTypeTable*) override {} + void visit(AstConstPool*) override {} + void visit(AstNodeModule* nodep) override { // Called on top module from Netlist, other modules from the cell creating them, // and packages UINFO(8, " " << nodep << endl); @@ -839,7 +839,7 @@ class LinkDotFindVisitor final : public VNVisitor { UINFO(5, "Module not under any CELL or top - dead module: " << nodep << endl); } } - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { UASSERT_OBJ(m_curSymp, nodep, "Class not under module/package/$unit"); UINFO(8, " " << nodep << endl); VL_RESTORER(m_scope); @@ -871,12 +871,12 @@ class LinkDotFindVisitor final : public VNVisitor { if (!m_explicitNew && m_statep->forPrimary()) makeImplicitNew(nodep); } } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { UASSERT_OBJ(m_statep->forScopeCreation(), nodep, "Scopes should only exist right after V3Scope"); // Ignored. Processed in next step } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { UINFO(5, " CELL under " << m_scope << " is " << nodep << endl); // Process XREFs/etc inside pins if (nodep->recursive() && m_inRecursion) return; @@ -911,7 +911,7 @@ class LinkDotFindVisitor final : public VNVisitor { if (nodep->modp()) iterate(nodep->modp()); } } - virtual void visit(AstCellInline* nodep) override { + void visit(AstCellInline* nodep) override { UINFO(5, " CELLINLINE under " << m_scope << " is " << nodep << endl); VSymEnt* aboveSymp = m_curSymp; // If baz__DOT__foo__DOT__bar, we need to find baz__DOT__foo and add bar to it. @@ -931,11 +931,11 @@ class LinkDotFindVisitor final : public VNVisitor { m_statep->insertInline(aboveSymp, m_modSymp, nodep, nodep->name()); } } - virtual void visit(AstDefParam* nodep) override { + void visit(AstDefParam* nodep) override { nodep->user1p(m_curSymp); iterateChildren(nodep); } - virtual void visit(AstNodeBlock* nodep) override { + void visit(AstNodeBlock* nodep) override { UINFO(5, " " << nodep << endl); if (nodep->name() == "" && nodep->unnamed()) { // Unnamed blocks are only important when they contain var @@ -967,7 +967,7 @@ class LinkDotFindVisitor final : public VNVisitor { } } } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { // NodeTask: Remember its name for later resolution UINFO(5, " " << nodep << endl); UASSERT_OBJ(m_curSymp && m_modSymp, nodep, "Function/Task not under module?"); @@ -1040,7 +1040,7 @@ class LinkDotFindVisitor final : public VNVisitor { m_ftaskp = nullptr; } } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { // Var: Remember its name for later resolution UASSERT_OBJ(m_curSymp && m_modSymp, nodep, "Var not under module?"); iterateChildren(nodep); @@ -1173,18 +1173,18 @@ class LinkDotFindVisitor final : public VNVisitor { } } } - virtual void visit(AstTypedef* nodep) override { + void visit(AstTypedef* nodep) override { UASSERT_OBJ(m_curSymp, nodep, "Typedef not under module/package/$unit"); iterateChildren(nodep); m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_classOrPackagep); } - virtual void visit(AstTypedefFwd* nodep) override { + void visit(AstTypedefFwd* nodep) override { UASSERT_OBJ(m_curSymp, nodep, "Typedef not under module/package/$unit"); iterateChildren(nodep); // No need to insert, only the real typedef matters, but need to track for errors nodep->user1p(m_curSymp); } - virtual void visit(AstParamTypeDType* nodep) override { + void visit(AstParamTypeDType* nodep) override { UASSERT_OBJ(m_curSymp, nodep, "Parameter type not under module/package/$unit"); iterateChildren(nodep); m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_classOrPackagep); @@ -1195,11 +1195,11 @@ class LinkDotFindVisitor final : public VNVisitor { symp->exported(false); } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { // For dotted resolution, ignore all AstVars under functions, otherwise shouldn't exist UASSERT_OBJ(!m_statep->forScopeCreation(), nodep, "No CFuncs expected in tree yet"); } - virtual void visit(AstEnumItem* nodep) override { + void visit(AstEnumItem* nodep) override { // EnumItem: Remember its name for later resolution iterateChildren(nodep); // Find under either a task or the module's vars @@ -1238,7 +1238,7 @@ class LinkDotFindVisitor final : public VNVisitor { } if (ins) m_statep->insertSym(m_curSymp, nodep->name(), nodep, m_classOrPackagep); } - virtual void visit(AstPackageImport* nodep) override { + void visit(AstPackageImport* nodep) override { UINFO(4, " Link: " << nodep << endl); VSymEnt* const srcp = m_statep->getNodeSym(nodep->packagep()); if (nodep->name() == "*") { @@ -1256,7 +1256,7 @@ class LinkDotFindVisitor final : public VNVisitor { UINFO(9, " Link Done: " << nodep << endl); // No longer needed, but can't delete until any multi-instantiated modules are expanded } - virtual void visit(AstPackageExport* nodep) override { + void visit(AstPackageExport* nodep) override { UINFO(9, " Link: " << nodep << endl); VSymEnt* const srcp = m_statep->getNodeSym(nodep->packagep()); if (nodep->name() != "*") { @@ -1270,13 +1270,13 @@ class LinkDotFindVisitor final : public VNVisitor { UINFO(9, " Link Done: " << nodep << endl); // No longer needed, but can't delete until any multi-instantiated modules are expanded } - virtual void visit(AstPackageExportStarStar* nodep) override { + void visit(AstPackageExportStarStar* nodep) override { UINFO(4, " Link: " << nodep << endl); m_curSymp->exportStarStar(m_statep->symsp()); // No longer needed, but can't delete until any multi-instantiated modules are expanded } - virtual void visit(AstForeach* nodep) override { + void visit(AstForeach* nodep) override { // Symbol table needs nodep->name() as the index variable's name VL_RESTORER(m_curSymp); VSymEnt* const oldCurSymp = m_curSymp; @@ -1327,7 +1327,7 @@ class LinkDotFindVisitor final : public VNVisitor { } } - virtual void visit(AstWithParse* nodep) override { + void visit(AstWithParse* nodep) override { // Change WITHPARSE(FUNCREF, equation) to FUNCREF(WITH(equation)) const auto funcrefp = VN_AS(nodep->funcrefp(), NodeFTaskRef); UASSERT_OBJ(funcrefp, nodep, "'with' only can operate on a function/task"); @@ -1355,7 +1355,7 @@ class LinkDotFindVisitor final : public VNVisitor { nodep->replaceWith(funcrefp->unlinkFrBack()); VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstWith* nodep) override { + void visit(AstWith* nodep) override { // Symbol table needs nodep->name() as the index variable's name // Iteration will pickup the AstVar we made under AstWith VL_RESTORER(m_curSymp); @@ -1373,7 +1373,7 @@ class LinkDotFindVisitor final : public VNVisitor { } } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -1383,7 +1383,7 @@ public: iterate(rootp); } - virtual ~LinkDotFindVisitor() override = default; + ~LinkDotFindVisitor() override = default; }; //====================================================================== @@ -1425,9 +1425,9 @@ private: } // VISITs - virtual void visit(AstTypeTable*) override {} - virtual void visit(AstConstPool*) override {} - virtual void visit(AstNodeModule* nodep) override { + void visit(AstTypeTable*) override {} + void visit(AstConstPool*) override {} + void visit(AstNodeModule* nodep) override { UINFO(5, " " << nodep << endl); if (nodep->dead() || !nodep->user4()) { UINFO(4, "Mark dead module " << nodep << endl); @@ -1444,7 +1444,7 @@ private: m_modp = nullptr; } } - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { // Pin: Link to submodule's port // Deal with implicit definitions - do before Resolve visitor as may // be referenced above declaration @@ -1453,7 +1453,7 @@ private: pinImplicitExprRecurse(nodep->exprp()); } } - virtual void visit(AstDefParam* nodep) override { + void visit(AstDefParam* nodep) override { iterateChildren(nodep); nodep->v3warn(DEFPARAM, "defparam is deprecated (IEEE 1800-2017 C.4.1)\n" << nodep->warnMore() @@ -1475,7 +1475,7 @@ private: } VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstPort* nodep) override { + void visit(AstPort* nodep) override { // Port: Stash the pin number // Need to set pin numbers after varnames are created // But before we do the final resolution based on names @@ -1508,14 +1508,14 @@ private: // Ports not needed any more VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstAssignW* nodep) override { + void visit(AstAssignW* nodep) override { // Deal with implicit definitions // We used to nodep->allowImplicit() here, but it turns out // normal "assigns" can also make implicit wires. Yuk. pinImplicitExprRecurse(nodep->lhsp()); iterateChildren(nodep); } - virtual void visit(AstAssignAlias* nodep) override { + void visit(AstAssignAlias* nodep) override { // tran gates need implicit creation // As VarRefs don't exist in forPrimary, sanity check UASSERT_OBJ(!m_statep->forPrimary(), nodep, "Assign aliases unexpected pre-dot"); @@ -1527,13 +1527,13 @@ private: } iterateChildren(nodep); } - virtual void visit(AstImplicit* nodep) override { + void visit(AstImplicit* nodep) override { // Unsupported gates need implicit creation pinImplicitExprRecurse(nodep); // We're done with implicit gates VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstClassOrPackageRef* nodep) override { + void visit(AstClassOrPackageRef* nodep) override { if (auto* const fwdp = VN_CAST(nodep->classOrPackageNodep(), TypedefFwd)) { // Relink forward definitions to the "real" definition VSymEnt* const foundp = m_statep->getNodeSym(fwdp)->findIdFallback(fwdp->name()); @@ -1555,7 +1555,7 @@ private: } iterateChildren(nodep); } - virtual void visit(AstTypedefFwd* nodep) override { + void visit(AstTypedefFwd* nodep) override { VSymEnt* const foundp = m_statep->getNodeSym(nodep)->findIdFallback(nodep->name()); if (!foundp && v3Global.opt.pedantic()) { // We only check it was ever really defined in pedantic mode, as it @@ -1570,7 +1570,7 @@ private: VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -1579,7 +1579,7 @@ public: UINFO(4, __FUNCTION__ << ": " << endl); iterate(rootp); } - virtual ~LinkDotParamVisitor() override = default; + ~LinkDotParamVisitor() override = default; }; //====================================================================== @@ -1594,12 +1594,12 @@ class LinkDotScopeVisitor final : public VNVisitor { static int debug() { return LinkDotState::debug(); } // VISITs - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Recurse..., backward as must do packages before using packages iterateChildrenBackwards(nodep); } - virtual void visit(AstConstPool*) override {} - virtual void visit(AstScope* nodep) override { + void visit(AstConstPool*) override {} + void visit(AstScope* nodep) override { UINFO(8, " SCOPE " << nodep << endl); UASSERT_OBJ(m_statep->forScopeCreation(), nodep, "Scopes should only exist right after V3Scope"); @@ -1611,7 +1611,7 @@ class LinkDotScopeVisitor final : public VNVisitor { m_modSymp = nullptr; m_scopep = nullptr; } - virtual void visit(AstVarScope* nodep) override { + void visit(AstVarScope* nodep) override { if (!nodep->varp()->isFuncLocal() && !nodep->varp()->isClassMember()) { VSymEnt* const varSymp = m_statep->insertSym(m_modSymp, nodep->varp()->name(), nodep, nullptr); @@ -1649,22 +1649,22 @@ class LinkDotScopeVisitor final : public VNVisitor { } } } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { VSymEnt* const symp = m_statep->insertBlock(m_modSymp, nodep->name(), nodep, nullptr); symp->fallbackp(m_modSymp); // No recursion, we don't want to pick up variables } - virtual void visit(AstForeach* nodep) override { + void visit(AstForeach* nodep) override { VSymEnt* const symp = m_statep->insertBlock(m_modSymp, nodep->name(), nodep, nullptr); symp->fallbackp(m_modSymp); // No recursion, we don't want to pick up variables } - virtual void visit(AstWith* nodep) override { + void visit(AstWith* nodep) override { VSymEnt* const symp = m_statep->insertBlock(m_modSymp, nodep->name(), nodep, nullptr); symp->fallbackp(m_modSymp); // No recursion, we don't want to pick up variables } - virtual void visit(AstAssignAlias* nodep) override { + void visit(AstAssignAlias* nodep) override { // Track aliases created by V3Inline; if we get a VARXREF(aliased_from) // we'll need to replace it with a VARXREF(aliased_to) if (debug() >= 9) nodep->dumpTree(cout, "- alias: "); @@ -1674,7 +1674,7 @@ class LinkDotScopeVisitor final : public VNVisitor { fromVscp->user2p(toVscp); iterateChildren(nodep); } - virtual void visit(AstAssignVarScope* nodep) override { + void visit(AstAssignVarScope* nodep) override { UINFO(5, "ASSIGNVARSCOPE " << nodep << endl); if (debug() >= 9) nodep->dumpTree(cout, "- avs: "); VSymEnt* rhsSymp; @@ -1734,9 +1734,9 @@ class LinkDotScopeVisitor final : public VNVisitor { } // For speed, don't recurse things that can't have scope // Note we allow AstNodeStmt's as generates may be under them - virtual void visit(AstCell*) override {} - virtual void visit(AstVar*) override {} - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstCell*) override {} + void visit(AstVar*) override {} + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -1745,7 +1745,7 @@ public: UINFO(4, __FUNCTION__ << ": " << endl); iterate(rootp); } - virtual ~LinkDotScopeVisitor() override = default; + ~LinkDotScopeVisitor() override = default; }; //====================================================================== @@ -1760,7 +1760,7 @@ class LinkDotIfaceVisitor final : public VNVisitor { static int debug() { return LinkDotState::debug(); } // VISITs - virtual void visit(AstModport* nodep) override { + void visit(AstModport* nodep) override { // Modport: Remember its name for later resolution UINFO(5, " fiv: " << nodep << endl); VL_RESTORER(m_curSymp); @@ -1772,7 +1772,7 @@ class LinkDotIfaceVisitor final : public VNVisitor { iterateChildren(nodep); } } - virtual void visit(AstModportFTaskRef* nodep) override { + void visit(AstModportFTaskRef* nodep) override { UINFO(5, " fif: " << nodep << endl); iterateChildren(nodep); if (nodep->isExport()) nodep->v3warn(E_UNSUPPORTED, "Unsupported: modport export"); @@ -1795,7 +1795,7 @@ class LinkDotIfaceVisitor final : public VNVisitor { VL_DO_DANGLING(pushDeletep(nodep), nodep); } } - virtual void visit(AstModportVarRef* nodep) override { + void visit(AstModportVarRef* nodep) override { UINFO(5, " fiv: " << nodep << endl); iterateChildren(nodep); VSymEnt* const symp = m_curSymp->findIdFallback(nodep->name()); @@ -1820,7 +1820,7 @@ class LinkDotIfaceVisitor final : public VNVisitor { VL_DO_DANGLING(pushDeletep(nodep), nodep); } } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -1830,7 +1830,7 @@ public: UINFO(4, __FUNCTION__ << ": " << endl); iterate(nodep); } - virtual ~LinkDotIfaceVisitor() override = default; + ~LinkDotIfaceVisitor() override = default; }; void LinkDotState::computeIfaceModSyms() { @@ -2005,13 +2005,13 @@ private: } // VISITs - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Recurse..., backward as must do packages before using packages iterateChildrenBackwards(nodep); } - virtual void visit(AstTypeTable*) override {} - virtual void visit(AstConstPool*) override {} - virtual void visit(AstNodeModule* nodep) override { + void visit(AstTypeTable*) override {} + void visit(AstConstPool*) override {} + void visit(AstNodeModule* nodep) override { if (nodep->dead()) return; checkNoDot(nodep); UINFO(8, " " << nodep << endl); @@ -2025,7 +2025,7 @@ private: m_modp = nullptr; m_ds.m_dotSymp = m_curSymp = m_modSymp = nullptr; } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { UINFO(8, " " << nodep << endl); VL_RESTORER(m_modSymp); VL_RESTORER(m_curSymp); @@ -2036,14 +2036,14 @@ private: m_ds.m_dotSymp = m_curSymp = m_modSymp = nullptr; } } - virtual void visit(AstCellInline* nodep) override { + void visit(AstCellInline* nodep) override { checkNoDot(nodep); if (m_statep->forScopeCreation() && !v3Global.opt.vpi()) { nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep); } } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { // Cell: Recurse inside or cleanup not founds checkNoDot(nodep); AstNode::user5ClearTree(); @@ -2072,7 +2072,7 @@ private: // Parent module inherits child's publicity // This is done bottom up in the LinkBotupVisitor stage } - virtual void visit(AstClassRefDType* nodep) override { + void visit(AstClassRefDType* nodep) override { // Cell: Recurse inside or cleanup not founds checkNoDot(nodep); AstNode::user5ClearTree(); @@ -2089,7 +2089,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { // Pin: Link to submodule's port checkNoDot(nodep); iterateChildren(nodep); @@ -2130,7 +2130,7 @@ private: } // Early return() above when deleted } - virtual void visit(AstDot* nodep) override { + void visit(AstDot* nodep) override { // Legal under a DOT: AstDot, AstParseRef, AstPackageRef, AstNodeSel // also a DOT can be part of an expression, but only above plus // AstFTaskRef are legal children @@ -2239,7 +2239,7 @@ private: m_ds.m_dotp = lastStates.m_dotp; } } - virtual void visit(AstParseRef* nodep) override { + void visit(AstParseRef* nodep) override { if (nodep->user3SetOnce()) return; UINFO(9, " linkPARSEREF " << m_ds.ascii() << " n=" << nodep << endl); // m_curSymp is symbol table of outer expression @@ -2538,7 +2538,7 @@ private: } if (start) m_ds = lastStates; } - virtual void visit(AstClassOrPackageRef* nodep) override { + void visit(AstClassOrPackageRef* nodep) override { // Class: Recurse inside or cleanup not founds // checkNoDot not appropriate, can be under a dot AstNode::user5ClearTree(); @@ -2559,7 +2559,7 @@ private: } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { // VarRef: Resolve its reference // ParseRefs are used the first pass (forPrimary) so we shouldn't get can't find // errors here now that we have a VarRef. @@ -2581,7 +2581,7 @@ private: } } } - virtual void visit(AstVarXRef* nodep) override { + void visit(AstVarXRef* nodep) override { // VarRef: Resolve its reference // We always link even if varp() is set, because the module we choose may change // due to creating new modules, flattening, etc. @@ -2661,18 +2661,18 @@ private: } } } - virtual void visit(AstEnumDType* nodep) override { + void visit(AstEnumDType* nodep) override { iterateChildren(nodep); AstRefDType* const refdtypep = VN_CAST(nodep->subDTypep(), RefDType); if (refdtypep && (nodep == refdtypep->subDTypep())) { refdtypep->v3error("Self-referential enumerated type definition"); } } - virtual void visit(AstEnumItemRef* nodep) override { + void visit(AstEnumItemRef* nodep) override { // EnumItemRef may be under a dot. Should already be resolved. iterateChildren(nodep); } - virtual void visit(AstMethodCall* nodep) override { + void visit(AstMethodCall* nodep) override { // Created here so should already be resolved. VL_RESTORER(m_ds); { @@ -2680,7 +2680,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { checkNoDot(nodep); iterateChildren(nodep); if (m_statep->forPrimary() && nodep->isIO() && !m_ftaskp && !nodep->user4()) { @@ -2688,7 +2688,7 @@ private: "Input/output/inout does not appear in port list: " << nodep->prettyNameQ()); } } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { if (nodep->user3SetOnce()) return; UINFO(8, " " << nodep << endl); UINFO(8, " " << m_ds.ascii() << endl); @@ -2854,7 +2854,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstSelBit* nodep) override { + void visit(AstSelBit* nodep) override { if (nodep->user3SetOnce()) return; iterateAndNextNull(nodep->fromp()); if (m_ds.m_dotPos @@ -2882,7 +2882,7 @@ private: VL_DO_DANGLING(pushDeletep(nodep), nodep); } } - virtual void visit(AstNodePreSel* nodep) override { + void visit(AstNodePreSel* nodep) override { // Excludes simple AstSelBit, see above if (nodep->user3SetOnce()) return; if (m_ds.m_dotPos @@ -2901,11 +2901,11 @@ private: iterateAndNextNull(nodep->attrp()); } } - virtual void visit(AstMemberSel* nodep) override { + void visit(AstMemberSel* nodep) override { // checkNoDot not appropriate, can be under a dot iterateChildren(nodep); } - virtual void visit(AstNodeBlock* nodep) override { + void visit(AstNodeBlock* nodep) override { UINFO(5, " " << nodep << endl); checkNoDot(nodep); VSymEnt* const oldCurSymp = m_curSymp; @@ -2919,7 +2919,7 @@ private: m_ds.m_dotSymp = m_curSymp = oldCurSymp; UINFO(5, " cur=se" << cvtToHex(m_curSymp) << endl); } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { UINFO(5, " " << nodep << endl); checkNoDot(nodep); if (nodep->isExternDef()) { @@ -2941,7 +2941,7 @@ private: m_ds.m_dotSymp = m_curSymp = oldCurSymp; m_ftaskp = nullptr; } - virtual void visit(AstForeach* nodep) override { + void visit(AstForeach* nodep) override { UINFO(5, " " << nodep << endl); checkNoDot(nodep); VSymEnt* const oldCurSymp = m_curSymp; @@ -2951,7 +2951,7 @@ private: } m_ds.m_dotSymp = m_curSymp = oldCurSymp; } - virtual void visit(AstWith* nodep) override { + void visit(AstWith* nodep) override { UINFO(5, " " << nodep << endl); checkNoDot(nodep); VSymEnt* const oldCurSymp = m_curSymp; @@ -2961,12 +2961,12 @@ private: } m_ds.m_dotSymp = m_curSymp = oldCurSymp; } - virtual void visit(AstLambdaArgRef* nodep) override { + void visit(AstLambdaArgRef* nodep) override { UINFO(5, " " << nodep << endl); // No checknodot(nodep), visit(AstScope) will check for LambdaArgRef iterateChildren(nodep); } - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { UINFO(5, " " << nodep << endl); checkNoDot(nodep); VL_RESTORER(m_curSymp); @@ -3041,7 +3041,7 @@ private: } } } - virtual void visit(AstRefDType* nodep) override { + void visit(AstRefDType* nodep) override { // Resolve its reference if (nodep->user3SetOnce()) return; if (AstNode* const cpackagep = nodep->classOrPackageOpp()) { @@ -3112,7 +3112,7 @@ private: } iterateChildren(nodep); } - virtual void visit(AstDpiExport* nodep) override { + void visit(AstDpiExport* nodep) override { // AstDpiExport: Make sure the function referenced exists, then dump it iterateChildren(nodep); checkNoDot(nodep); @@ -3130,35 +3130,35 @@ private: } VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstPackageImport* nodep) override { + void visit(AstPackageImport* nodep) override { // No longer needed checkNoDot(nodep); VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstPackageExport* nodep) override { + void visit(AstPackageExport* nodep) override { // No longer needed checkNoDot(nodep); VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstPackageExportStarStar* nodep) override { + void visit(AstPackageExportStarStar* nodep) override { // No longer needed checkNoDot(nodep); VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstCellRef* nodep) override { + void visit(AstCellRef* nodep) override { UINFO(5, " AstCellRef: " << nodep << " " << m_ds.ascii() << endl); iterateChildren(nodep); } - virtual void visit(AstCellArrayRef* nodep) override { + void visit(AstCellArrayRef* nodep) override { UINFO(5, " AstCellArrayRef: " << nodep << " " << m_ds.ascii() << endl); // Expression already iterated } - virtual void visit(AstUnlinkedRef* nodep) override { + void visit(AstUnlinkedRef* nodep) override { UINFO(5, " AstCellArrayRef: " << nodep << " " << m_ds.ascii() << endl); // No need to iterate, if we have a UnlinkedVarXRef, we're already done } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { checkNoDot(nodep); iterateChildren(nodep); } @@ -3170,7 +3170,7 @@ public: UINFO(4, __FUNCTION__ << ": " << endl); iterate(rootp); } - virtual ~LinkDotResolveVisitor() override = default; + ~LinkDotResolveVisitor() override = default; }; //###################################################################### diff --git a/src/V3LinkInc.cpp b/src/V3LinkInc.cpp index 66dcbf8e1..a19b1e282 100644 --- a/src/V3LinkInc.cpp +++ b/src/V3LinkInc.cpp @@ -89,12 +89,12 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modIncrementsNum); m_modIncrementsNum = 0; iterateChildren(nodep); } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { // Special, as statements need to be put in different places // Preconditions insert first just before themselves (the normal // rule for other statement types) @@ -111,7 +111,7 @@ private: // Done the loop m_insStmtp = nullptr; // Next thing should be new statement } - virtual void visit(AstForeach* nodep) override { + void visit(AstForeach* nodep) override { // Special, as statements need to be put in different places // Body insert just before themselves m_insStmtp = nullptr; // First thing should be new statement @@ -119,7 +119,7 @@ private: // Done the loop m_insStmtp = nullptr; // Next thing should be new statement } - virtual void visit(AstJumpBlock* nodep) override { + void visit(AstJumpBlock* nodep) override { // Special, as statements need to be put in different places // Body insert just before themselves m_insStmtp = nullptr; // First thing should be new statement @@ -127,7 +127,7 @@ private: // Done the loop m_insStmtp = nullptr; // Next thing should be new statement } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { m_insStmtp = nodep; iterateAndNextNull(nodep->condp()); m_insStmtp = nullptr; @@ -135,7 +135,7 @@ private: iterateAndNextNull(nodep->elsesp()); m_insStmtp = nullptr; } - virtual void visit(AstCaseItem* nodep) override { + void visit(AstCaseItem* nodep) override { m_insMode = IM_BEFORE; { VL_RESTORER(m_unsupportedHere); @@ -145,11 +145,11 @@ private: m_insStmtp = nullptr; // Next thing should be new statement iterateAndNextNull(nodep->bodysp()); } - virtual void visit(AstNodeFor* nodep) override { // LCOV_EXCL_LINE + void visit(AstNodeFor* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc( "For statements should have been converted to while statements in V3Begin.cpp"); } - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { if (!nodep->isStatement()) { iterateChildren(nodep); return; @@ -165,11 +165,11 @@ private: UINFO(9, "Marking unsupported " << nodep << endl); iterateChildren(nodep); } - virtual void visit(AstLogAnd* nodep) override { unsupported_visit(nodep); } - virtual void visit(AstLogOr* nodep) override { unsupported_visit(nodep); } - virtual void visit(AstLogEq* nodep) override { unsupported_visit(nodep); } - virtual void visit(AstLogIf* nodep) override { unsupported_visit(nodep); } - virtual void visit(AstNodeCond* nodep) override { unsupported_visit(nodep); } + void visit(AstLogAnd* nodep) override { unsupported_visit(nodep); } + void visit(AstLogOr* nodep) override { unsupported_visit(nodep); } + void visit(AstLogEq* nodep) override { unsupported_visit(nodep); } + void visit(AstLogIf* nodep) override { unsupported_visit(nodep); } + void visit(AstNodeCond* nodep) override { unsupported_visit(nodep); } void prepost_visit(AstNodeTriop* nodep) { // Check if we are underneath a statement if (!m_insStmtp) { @@ -257,17 +257,17 @@ private: nodep->replaceWith(new AstVarRef(varrefp->fileline(), varp, VAccess::WRITE)); VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstPreAdd* nodep) override { prepost_visit(nodep); } - virtual void visit(AstPostAdd* nodep) override { prepost_visit(nodep); } - virtual void visit(AstPreSub* nodep) override { prepost_visit(nodep); } - virtual void visit(AstPostSub* nodep) override { prepost_visit(nodep); } - virtual void visit(AstGenFor* nodep) override { iterateChildren(nodep); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstPreAdd* nodep) override { prepost_visit(nodep); } + void visit(AstPostAdd* nodep) override { prepost_visit(nodep); } + void visit(AstPreSub* nodep) override { prepost_visit(nodep); } + void visit(AstPostSub* nodep) override { prepost_visit(nodep); } + void visit(AstGenFor* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit LinkIncVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~LinkIncVisitor() override = default; + ~LinkIncVisitor() override = default; }; //###################################################################### diff --git a/src/V3LinkJump.cpp b/src/V3LinkJump.cpp index 9b85ac6f6..ef40653a8 100644 --- a/src/V3LinkJump.cpp +++ b/src/V3LinkJump.cpp @@ -122,7 +122,7 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { if (nodep->dead()) return; VL_RESTORER(m_modp); VL_RESTORER(m_modRepeatNum); @@ -132,12 +132,12 @@ private: iterateChildren(nodep); } } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { m_ftaskp = nodep; iterateChildren(nodep); m_ftaskp = nullptr; } - virtual void visit(AstNodeBlock* nodep) override { + void visit(AstNodeBlock* nodep) override { UINFO(8, " " << nodep << endl); VL_RESTORER(m_inFork); m_blockStack.push_back(nodep); @@ -147,7 +147,7 @@ private: } m_blockStack.pop_back(); } - virtual void visit(AstRepeat* nodep) override { + void visit(AstRepeat* nodep) override { // So later optimizations don't need to deal with them, // REPEAT(count,body) -> loop=count,WHILE(loop>0) { body, loop-- } // Note var can be signed or unsigned based on original number. @@ -175,7 +175,7 @@ private: nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstWait* nodep) override { + void visit(AstWait* nodep) override { nodep->v3warn(E_UNSUPPORTED, "Unsupported: wait statements"); // Statements we'll just execute immediately; equivalent to if they followed this if (AstNode* const bodysp = nodep->bodysp()) { @@ -186,7 +186,7 @@ private: } VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { // Don't need to track AstRepeat/AstFor as they have already been converted VL_RESTORER(m_loopp); VL_RESTORER(m_loopInc); @@ -200,14 +200,14 @@ private: iterateAndNextNull(nodep->incsp()); } } - virtual void visit(AstForeach* nodep) override { + void visit(AstForeach* nodep) override { VL_RESTORER(m_loopp); { m_loopp = nodep; iterateAndNextNull(nodep->bodysp()); } } - virtual void visit(AstReturn* nodep) override { + void visit(AstReturn* nodep) override { iterateChildren(nodep); const AstFunc* const funcp = VN_CAST(m_ftaskp, Func); if (m_inFork) { @@ -235,7 +235,7 @@ private: nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstBreak* nodep) override { + void visit(AstBreak* nodep) override { iterateChildren(nodep); if (!m_loopp) { nodep->v3error("break isn't underneath a loop"); @@ -247,7 +247,7 @@ private: nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstContinue* nodep) override { + void visit(AstContinue* nodep) override { iterateChildren(nodep); if (!m_loopp) { nodep->v3error("continue isn't underneath a loop"); @@ -260,7 +260,7 @@ private: nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstDisable* nodep) override { + void visit(AstDisable* nodep) override { UINFO(8, " DISABLE " << nodep << endl); iterateChildren(nodep); AstNodeBlock* blockp = nullptr; @@ -285,16 +285,16 @@ private: VL_DO_DANGLING(pushDeletep(nodep), nodep); // if (debug() >= 9) { UINFO(0, "\n"); beginp->dumpTree(cout, " labelo: "); } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (m_loopInc && nodep->varp()) nodep->varp()->usedLoopIdx(true); } - virtual void visit(AstConst*) override {} - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstConst*) override {} + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit LinkJumpVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~LinkJumpVisitor() override = default; + ~LinkJumpVisitor() override = default; }; //###################################################################### diff --git a/src/V3LinkLValue.cpp b/src/V3LinkLValue.cpp index a05407d37..0925b89c3 100644 --- a/src/V3LinkLValue.cpp +++ b/src/V3LinkLValue.cpp @@ -46,7 +46,7 @@ private: // VISITs // Result handing - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { // VarRef: LValue its reference if (m_setRefLvalue != VAccess::NOCHANGE) nodep->access(m_setRefLvalue); if (nodep->varp()) { @@ -65,7 +65,7 @@ private: } // Nodes that start propagating down lvalues - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { if (nodep->modVarp() && nodep->modVarp()->isWritable()) { // When the varref's were created, we didn't know the I/O state // Now that we do, and it's from a output, we know it's a lvalue @@ -76,7 +76,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { VL_RESTORER(m_setRefLvalue); VL_RESTORER(m_setContinuously); { @@ -92,7 +92,7 @@ private: iterateAndNextNull(nodep->rhsp()); } } - virtual void visit(AstRelease* nodep) override { + void visit(AstRelease* nodep) override { VL_RESTORER(m_setRefLvalue); VL_RESTORER(m_setContinuously); { @@ -101,7 +101,7 @@ private: iterateAndNextNull(nodep->lhsp()); } } - virtual void visit(AstCastDynamic* nodep) override { + void visit(AstCastDynamic* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::NOCHANGE; @@ -110,7 +110,7 @@ private: iterateAndNextNull(nodep->top()); } } - virtual void visit(AstFOpen* nodep) override { + void visit(AstFOpen* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; @@ -120,7 +120,7 @@ private: iterateAndNextNull(nodep->modep()); } } - virtual void visit(AstFOpenMcd* nodep) override { + void visit(AstFOpenMcd* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; @@ -129,14 +129,14 @@ private: iterateAndNextNull(nodep->filenamep()); } } - virtual void visit(AstFClose* nodep) override { + void visit(AstFClose* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; iterateAndNextNull(nodep->filep()); } } - virtual void visit(AstFError* nodep) override { + void visit(AstFError* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; @@ -144,21 +144,21 @@ private: iterateAndNextNull(nodep->strp()); } } - virtual void visit(AstFFlush* nodep) override { + void visit(AstFFlush* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; iterateAndNextNull(nodep->filep()); } } - virtual void visit(AstFGetC* nodep) override { + void visit(AstFGetC* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; iterateAndNextNull(nodep->filep()); } } - virtual void visit(AstFGetS* nodep) override { + void visit(AstFGetS* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; @@ -166,7 +166,7 @@ private: iterateAndNextNull(nodep->strgp()); } } - virtual void visit(AstFRead* nodep) override { + void visit(AstFRead* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; @@ -174,7 +174,7 @@ private: iterateAndNextNull(nodep->filep()); } } - virtual void visit(AstFScanF* nodep) override { + void visit(AstFScanF* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; @@ -182,33 +182,33 @@ private: iterateAndNextNull(nodep->exprsp()); } } - virtual void visit(AstFUngetC* nodep) override { + void visit(AstFUngetC* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; iterateAndNextNull(nodep->filep()); } } - virtual void visit(AstSScanF* nodep) override { + void visit(AstSScanF* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; iterateAndNextNull(nodep->exprsp()); } } - virtual void visit(AstSysIgnore* nodep) override { + void visit(AstSysIgnore* nodep) override { // Can't know if lvalue or not; presume so as stricter VL_RESTORER(m_setRefLvalue); iterateChildren(nodep); } - virtual void visit(AstRand* nodep) override { + void visit(AstRand* nodep) override { VL_RESTORER(m_setRefLvalue); { if (!nodep->urandom()) m_setRefLvalue = VAccess::WRITE; iterateAndNextNull(nodep->seedp()); } } - virtual void visit(AstReadMem* nodep) override { + void visit(AstReadMem* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; @@ -219,14 +219,14 @@ private: iterateAndNextNull(nodep->msbp()); } } - virtual void visit(AstTestPlusArgs* nodep) override { + void visit(AstTestPlusArgs* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::NOCHANGE; iterateAndNextNull(nodep->searchp()); } } - virtual void visit(AstValuePlusArgs* nodep) override { + void visit(AstValuePlusArgs* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::NOCHANGE; @@ -235,7 +235,7 @@ private: iterateAndNextNull(nodep->outp()); } } - virtual void visit(AstSFormat* nodep) override { + void visit(AstSFormat* nodep) override { VL_RESTORER(m_setRefLvalue); { m_setRefLvalue = VAccess::WRITE; @@ -254,13 +254,13 @@ private: iterateAndNextNull(nodep->thsp()); } } - virtual void visit(AstPreAdd* nodep) override { prepost_visit(nodep); } - virtual void visit(AstPostAdd* nodep) override { prepost_visit(nodep); } - virtual void visit(AstPreSub* nodep) override { prepost_visit(nodep); } - virtual void visit(AstPostSub* nodep) override { prepost_visit(nodep); } + void visit(AstPreAdd* nodep) override { prepost_visit(nodep); } + void visit(AstPostAdd* nodep) override { prepost_visit(nodep); } + void visit(AstPreSub* nodep) override { prepost_visit(nodep); } + void visit(AstPostSub* nodep) override { prepost_visit(nodep); } // Nodes that change LValue state - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { VL_RESTORER(m_setRefLvalue); { iterateAndNextNull(nodep->lhsp()); @@ -270,7 +270,7 @@ private: iterateAndNextNull(nodep->thsp()); } } - virtual void visit(AstNodeSel* nodep) override { + void visit(AstNodeSel* nodep) override { VL_RESTORER(m_setRefLvalue); { // Only set lvalues on the from iterateAndNextNull(nodep->lhsp()); @@ -278,14 +278,14 @@ private: iterateAndNextNull(nodep->rhsp()); } } - virtual void visit(AstCellArrayRef* nodep) override { + void visit(AstCellArrayRef* nodep) override { VL_RESTORER(m_setRefLvalue); { // selp is not an lvalue m_setRefLvalue = VAccess::NOCHANGE; iterateAndNextNull(nodep->selp()); } } - virtual void visit(AstNodePreSel* nodep) override { + void visit(AstNodePreSel* nodep) override { VL_RESTORER(m_setRefLvalue); { // Only set lvalues on the from iterateAndNextNull(nodep->fromp()); @@ -294,12 +294,12 @@ private: iterateAndNextNull(nodep->thsp()); } } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { m_ftaskp = nodep; iterateChildren(nodep); m_ftaskp = nullptr; } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { AstNode* pinp = nodep->pinsp(); const AstNodeFTask* const taskp = nodep->taskp(); // We'll deal with mismatching pins later @@ -321,7 +321,7 @@ private: } } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -329,7 +329,7 @@ public: : m_setRefLvalue{start} { iterate(nodep); } - virtual ~LinkLValueVisitor() override = default; + ~LinkLValueVisitor() override = default; }; //###################################################################### diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index af7185f60..2a4ce4bc0 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -122,7 +122,7 @@ private: } // VISITs - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { if (!nodep->user1SetOnce()) { // Process only once. V3Config::applyFTask(m_modp, nodep); cleanFileline(nodep); @@ -139,7 +139,7 @@ private: } } } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { if (!nodep->user1SetOnce()) { // Process only once. cleanFileline(nodep); UINFO(5, " " << nodep << endl); @@ -150,20 +150,20 @@ private: } } } - virtual void visit(AstNodeDType* nodep) override { visitIterateNodeDType(nodep); } - virtual void visit(AstEnumDType* nodep) override { + void visit(AstNodeDType* nodep) override { visitIterateNodeDType(nodep); } + void visit(AstEnumDType* nodep) override { if (nodep->name() == "") { nodep->name(nameFromTypedef(nodep)); // Might still remain "" } visitIterateNodeDType(nodep); } - virtual void visit(AstNodeUOrStructDType* nodep) override { + void visit(AstNodeUOrStructDType* nodep) override { if (nodep->name() == "") { nodep->name(nameFromTypedef(nodep)); // Might still remain "" } visitIterateNodeDType(nodep); } - virtual void visit(AstEnumItem* nodep) override { + void visit(AstEnumItem* nodep) override { // Expand ranges cleanFileline(nodep); iterateChildren(nodep); @@ -198,7 +198,7 @@ private: } } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { cleanFileline(nodep); if (nodep->lifetime().isNone()) { if (m_ftaskp) { @@ -296,7 +296,7 @@ private: } } - virtual void visit(AstAttrOf* nodep) override { + void visit(AstAttrOf* nodep) override { cleanFileline(nodep); iterateChildren(nodep); if (nodep->attrType() == VAttrType::DT_PUBLIC) { @@ -365,7 +365,7 @@ private: } } - virtual void visit(AstAlwaysPublic* nodep) override { + void visit(AstAlwaysPublic* nodep) override { // AlwaysPublic was attached under a var, but it's a statement that should be // at the same level as the var cleanFileline(nodep); @@ -381,7 +381,7 @@ private: } } - virtual void visit(AstDefImplicitDType* nodep) override { + void visit(AstDefImplicitDType* nodep) override { cleanFileline(nodep); UINFO(8, " DEFIMPLICIT " << nodep << endl); // Must remember what names we've already created, and combine duplicates @@ -422,7 +422,7 @@ private: VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstForeach* nodep) override { + void visit(AstForeach* nodep) override { // FOREACH(array, loopvars, body) UINFO(9, "FOREACH " << nodep << endl); // Separate iteration vars from base from variable @@ -457,7 +457,7 @@ private: iterateChildren(nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { V3Config::applyModule(nodep); VL_RESTORER(m_modp); @@ -490,16 +490,16 @@ private: iterateChildren(nodep); } } - virtual void visit(AstNodeProcedure* nodep) override { visitIterateNoValueMod(nodep); } - virtual void visit(AstAlways* nodep) override { + void visit(AstNodeProcedure* nodep) override { visitIterateNoValueMod(nodep); } + void visit(AstAlways* nodep) override { VL_RESTORER(m_inAlways); m_inAlways = true; visitIterateNoValueMod(nodep); } - virtual void visit(AstCover* nodep) override { visitIterateNoValueMod(nodep); } - virtual void visit(AstRestrict* nodep) override { visitIterateNoValueMod(nodep); } + void visit(AstCover* nodep) override { visitIterateNoValueMod(nodep); } + void visit(AstRestrict* nodep) override { visitIterateNoValueMod(nodep); } - virtual void visit(AstBegin* nodep) override { + void visit(AstBegin* nodep) override { V3Config::applyCoverageBlock(m_modp, nodep); cleanFileline(nodep); const AstNode* const backp = nodep->backp(); @@ -525,7 +525,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstGenCase* nodep) override { + void visit(AstGenCase* nodep) override { ++m_genblkNum; cleanFileline(nodep); { @@ -536,7 +536,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstGenIf* nodep) override { + void visit(AstGenIf* nodep) override { cleanFileline(nodep); const bool nestedIf = (VN_IS(nodep->backp(), Begin) && nestedIfBegin(VN_CAST(nodep->backp(), Begin))); @@ -551,39 +551,39 @@ private: iterateChildren(nodep); } } - virtual void visit(AstCase* nodep) override { + void visit(AstCase* nodep) override { V3Config::applyCase(nodep); cleanFileline(nodep); iterateChildren(nodep); } - virtual void visit(AstPrintTimeScale* nodep) override { + void visit(AstPrintTimeScale* nodep) override { // Inlining may change hierarchy, so just save timescale where needed cleanFileline(nodep); iterateChildren(nodep); nodep->name(m_modp->name()); nodep->timeunit(m_modp->timeunit()); } - virtual void visit(AstSFormatF* nodep) override { + void visit(AstSFormatF* nodep) override { cleanFileline(nodep); iterateChildren(nodep); nodep->timeunit(m_modp->timeunit()); } - virtual void visit(AstTime* nodep) override { + void visit(AstTime* nodep) override { cleanFileline(nodep); iterateChildren(nodep); nodep->timeunit(m_modp->timeunit()); } - virtual void visit(AstTimeD* nodep) override { + void visit(AstTimeD* nodep) override { cleanFileline(nodep); iterateChildren(nodep); nodep->timeunit(m_modp->timeunit()); } - virtual void visit(AstTimeImport* nodep) override { + void visit(AstTimeImport* nodep) override { cleanFileline(nodep); iterateChildren(nodep); nodep->timeunit(m_modp->timeunit()); } - virtual void visit(AstEventControl* nodep) override { + void visit(AstEventControl* nodep) override { cleanFileline(nodep); iterateChildren(nodep); AstAlways* const alwaysp = VN_CAST(nodep->backp(), Always); @@ -605,7 +605,7 @@ private: } } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { // Default: Just iterate cleanFileline(nodep); iterateChildren(nodep); @@ -614,7 +614,7 @@ private: public: // CONSTRUCTORS explicit LinkParseVisitor(AstNetlist* rootp) { iterate(rootp); } - virtual ~LinkParseVisitor() override = default; + ~LinkParseVisitor() override = default; }; //###################################################################### diff --git a/src/V3LinkResolve.cpp b/src/V3LinkResolve.cpp index f1b859b51..c7dc0ef6f 100644 --- a/src/V3LinkResolve.cpp +++ b/src/V3LinkResolve.cpp @@ -62,7 +62,7 @@ private: // TODO: Most of these visitors are here for historical reasons. // TODO: ExpectDecriptor can move to data type resolution, and the rest // TODO: could move to V3LinkParse to get them out of the way of elaboration - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { // Module: Create sim table for entire module and iterate UINFO(8, "MODULE " << nodep << endl); if (nodep->dead()) return; @@ -74,14 +74,14 @@ private: iterateChildren(nodep); } } - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { VL_RESTORER(m_classp); { m_classp = nodep; iterateChildren(nodep); } } - virtual void visit(AstInitialAutomatic* nodep) override { + void visit(AstInitialAutomatic* nodep) override { iterateChildren(nodep); // Initial assignments under function/tasks can just be simple // assignments without the initial @@ -89,13 +89,13 @@ private: VL_DO_DANGLING(nodep->replaceWith(nodep->bodysp()->unlinkFrBackWithNext()), nodep); } } - virtual void visit(AstNodeCoverOrAssert* nodep) override { + void visit(AstNodeCoverOrAssert* nodep) override { if (m_assertp) nodep->v3error("Assert not allowed under another assert"); m_assertp = nodep; iterateChildren(nodep); m_assertp = nullptr; } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { iterateChildren(nodep); if (m_classp && !nodep->isParam()) nodep->varType(VVarType::MEMBER); if (m_ftaskp) nodep->funcLocal(true); @@ -105,13 +105,13 @@ private: } } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { // VarRef: Resolve its reference if (nodep->varp()) nodep->varp()->usedParam(true); iterateChildren(nodep); } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { // NodeTask: Remember its name for later resolution if (m_underGenerate) nodep->underGenerate(true); // Remember the existing symbol table scope @@ -139,14 +139,14 @@ private: m_ftaskp = nullptr; if (nodep->dpiExport()) nodep->scopeNamep(new AstScopeName{nodep->fileline(), false}); } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { iterateChildren(nodep); if (nodep->taskp() && (nodep->taskp()->dpiContext() || nodep->taskp()->dpiExport())) { nodep->scopeNamep(new AstScopeName{nodep->fileline(), false}); } } - virtual void visit(AstSenItem* nodep) override { + void visit(AstSenItem* nodep) override { // Remove bit selects, and bark if it's not a simple variable iterateChildren(nodep); if (nodep->isClocked()) { @@ -214,7 +214,7 @@ private: } } - virtual void visit(AstNodePreSel* nodep) override { + void visit(AstNodePreSel* nodep) override { if (!nodep->attrp()) { iterateChildren(nodep); // Constification may change the fromp() to a constant, which will lose the @@ -249,7 +249,7 @@ private: } } - virtual void visit(AstCaseItem* nodep) override { + void visit(AstCaseItem* nodep) override { // Move default caseItems to the bottom of the list // That saves us from having to search each case list twice, for non-defaults and defaults iterateChildren(nodep); @@ -261,7 +261,7 @@ private: } } - virtual void visit(AstPragma* nodep) override { + void visit(AstPragma* nodep) override { if (nodep->pragType() == VPragmaType::HIER_BLOCK) { UASSERT_OBJ(m_modp, nodep, "HIER_BLOCK not under a module"); // If this is hierarchical mode which is to lib-create, @@ -411,39 +411,39 @@ private: if (filep && filep->varp()) filep->varp()->attrFileDescr(true); } - virtual void visit(AstFOpen* nodep) override { + void visit(AstFOpen* nodep) override { iterateChildren(nodep); expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef)); } - virtual void visit(AstFOpenMcd* nodep) override { + void visit(AstFOpenMcd* nodep) override { iterateChildren(nodep); expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef)); } - virtual void visit(AstFClose* nodep) override { + void visit(AstFClose* nodep) override { iterateChildren(nodep); expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef)); } - virtual void visit(AstFError* nodep) override { + void visit(AstFError* nodep) override { iterateChildren(nodep); expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef)); } - virtual void visit(AstFEof* nodep) override { + void visit(AstFEof* nodep) override { iterateChildren(nodep); expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef)); } - virtual void visit(AstFRead* nodep) override { + void visit(AstFRead* nodep) override { iterateChildren(nodep); expectDescriptor(nodep, VN_CAST(nodep->filep(), NodeVarRef)); } - virtual void visit(AstFScanF* nodep) override { + void visit(AstFScanF* nodep) override { iterateChildren(nodep); expectFormat(nodep, nodep->text(), nodep->exprsp(), true); } - virtual void visit(AstSScanF* nodep) override { + void visit(AstSScanF* nodep) override { iterateChildren(nodep); expectFormat(nodep, nodep->text(), nodep->exprsp(), true); } - virtual void visit(AstSFormatF* nodep) override { + void visit(AstSFormatF* nodep) override { iterateChildren(nodep); // Cleanup old-school displays without format arguments if (!nodep->hasFormat()) { @@ -466,7 +466,7 @@ private: } } - virtual void visit(AstUdpTable* nodep) override { + void visit(AstUdpTable* nodep) override { UINFO(5, "UDPTABLE " << nodep << endl); if (!v3Global.opt.bboxUnsup()) { // We don't warn until V3Inst, so that UDPs that are in libraries and @@ -497,49 +497,49 @@ private: } } - virtual void visit(AstScCtor* nodep) override { + void visit(AstScCtor* nodep) override { // Constructor info means the module must remain public m_modp->modPublic(true); iterateChildren(nodep); } - virtual void visit(AstScDtor* nodep) override { + void visit(AstScDtor* nodep) override { // Destructor info means the module must remain public m_modp->modPublic(true); iterateChildren(nodep); } - virtual void visit(AstScInt* nodep) override { + void visit(AstScInt* nodep) override { // Special class info means the module must remain public m_modp->modPublic(true); iterateChildren(nodep); } - virtual void visit(AstIfaceRefDType* nodep) override { + void visit(AstIfaceRefDType* nodep) override { // LinkDot checked modports, now remove references to them // Keeping them later caused problems with InstDeArray, // as it needed to make new modport arrays and such nodep->modportp(nullptr); iterateChildren(nodep); } - // virtual void visit(AstModport* nodep) override { ... } + // void visit(AstModport* nodep) override { ... } // We keep Modport's themselves around for XML dump purposes - virtual void visit(AstGenFor* nodep) override { + void visit(AstGenFor* nodep) override { VL_RESTORER(m_underGenerate); m_underGenerate = true; iterateChildren(nodep); } - virtual void visit(AstGenIf* nodep) override { + void visit(AstGenIf* nodep) override { VL_RESTORER(m_underGenerate); m_underGenerate = true; iterateChildren(nodep); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit LinkResolveVisitor(AstNetlist* rootp) { iterate(rootp); } - virtual ~LinkResolveVisitor() override = default; + ~LinkResolveVisitor() override = default; }; //###################################################################### @@ -556,29 +556,29 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITs - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Iterate modules backwards, in bottom-up order. iterateChildrenBackwards(nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); { m_modp = nodep; iterateChildren(nodep); } } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { // Parent module inherits child's publicity if (nodep->modp()->modPublic()) m_modp->modPublic(true); //** No iteration for speed } - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit LinkBotupVisitor(AstNetlist* rootp) { iterate(rootp); } - virtual ~LinkBotupVisitor() override = default; + ~LinkBotupVisitor() override = default; }; //###################################################################### diff --git a/src/V3Localize.cpp b/src/V3Localize.cpp index 27d652110..9a9bf51db 100644 --- a/src/V3Localize.cpp +++ b/src/V3Localize.cpp @@ -123,12 +123,12 @@ private: } // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { iterateChildrenConst(nodep); moveVarScopes(); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { UINFO(4, " CFUNC " << nodep << endl); VL_RESTORER(m_cfuncp); VL_RESTORER(m_nodeDepth); @@ -140,12 +140,12 @@ private: } } - virtual void visit(AstCCall* nodep) override { + void visit(AstCCall* nodep) override { m_cfuncp->user1(true); // Mark caller as not a leaf function iterateChildrenConst(nodep); } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { // Analyze RHS first so "a = a + 1" is detected as a read before write iterate(nodep->rhsp()); // For now we only consider an assignment that is directly under the function, (in @@ -163,7 +163,7 @@ private: iterate(nodep->lhsp()); } - virtual void visit(AstVarScope* nodep) override { + void visit(AstVarScope* nodep) override { if (!nodep->varp()->isPrimaryIO() // Not an IO the user wants to interact with && !nodep->varp()->isSigPublic() // Not something the user wants to interact with && !nodep->varp()->isFuncLocal() // Not already a function local (e.g.: argument) @@ -177,7 +177,7 @@ private: // No iterate; Don't want varrefs under it (e.g.: in child dtype?) } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { UASSERT_OBJ(m_cfuncp, nodep, "AstVarRef not under function"); AstVarScope* const varScopep = nodep->varScopep(); @@ -201,7 +201,7 @@ private: // No iterate; Don't want varrefs under it (e.g.: in child dtype?) } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { ++m_nodeDepth; iterateChildrenConst(nodep); --m_nodeDepth; @@ -210,7 +210,7 @@ private: public: // CONSTRUCTORS explicit LocalizeVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~LocalizeVisitor() override { + ~LocalizeVisitor() override { V3Stats::addStat("Optimizations, Vars localized", m_statLocVars); } }; diff --git a/src/V3MergeCond.cpp b/src/V3MergeCond.cpp index bb3389861..3dd8fe02e 100644 --- a/src/V3MergeCond.cpp +++ b/src/V3MergeCond.cpp @@ -823,7 +823,7 @@ private: } // VISITORS - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { if (AstNode* const condp = (*m_stmtPropertiesp)(nodep).m_condp) { // Check if mergeable if (!checkOrMakeMergeable(nodep)) return; @@ -836,7 +836,7 @@ private: } } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { // Check if mergeable if (!checkOrMakeMergeable(nodep)) { // If not mergeable, try to merge the branches @@ -850,25 +850,25 @@ private: addToList(nodep, nodep->condp()); } - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { if (m_mgFirstp && addIfHelpfulElseEndMerge(nodep)) return; iterateChildren(nodep); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { // Merge function body if (nodep->stmtsp()) process(nodep->stmtsp()); } // For speed, only iterate what is necessary. - virtual void visit(AstNetlist* nodep) override { iterateAndNextNull(nodep->modulesp()); } - virtual void visit(AstNodeModule* nodep) override { iterateAndNextNull(nodep->stmtsp()); } - virtual void visit(AstNode* nodep) override {} + void visit(AstNetlist* nodep) override { iterateAndNextNull(nodep->modulesp()); } + void visit(AstNodeModule* nodep) override { iterateAndNextNull(nodep->stmtsp()); } + void visit(AstNode* nodep) override {} public: // CONSTRUCTORS explicit MergeCondVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~MergeCondVisitor() override { + ~MergeCondVisitor() override { V3Stats::addStat("Optimizations, MergeCond merges", m_statMerges); V3Stats::addStat("Optimizations, MergeCond merged items", m_statMergedItems); V3Stats::addStat("Optimizations, MergeCond longest merge", m_statLongestList); diff --git a/src/V3Name.cpp b/src/V3Name.cpp index 9c3b422c8..ca8fde8f1 100644 --- a/src/V3Name.cpp +++ b/src/V3Name.cpp @@ -68,7 +68,7 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); { m_modp = nodep; @@ -76,44 +76,44 @@ private: } } // Add __PVT__ to names of local signals - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { // Don't iterate... Don't need temps for RANGES under the Var. rename(nodep, ((!m_modp || !m_modp->isTop()) && !nodep->isSigPublic() && !nodep->isFuncLocal() // Isn't exposed, and would mess up dpi import wrappers && !nodep->isTemp())); // Don't bother to rename internal signals } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { if (!nodep->user1()) { iterateChildren(nodep); rename(nodep, false); } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (nodep->varp()) { iterate(nodep->varp()); nodep->name(nodep->varp()->name()); } } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { if (!nodep->user1()) { rename(nodep, (!nodep->modp()->modPublic() && !VN_IS(nodep->modp(), ClassPackage))); iterateChildren(nodep); } } - virtual void visit(AstMemberDType* nodep) override { + void visit(AstMemberDType* nodep) override { if (!nodep->user1()) { rename(nodep, false); iterateChildren(nodep); } } - virtual void visit(AstMemberSel* nodep) override { + void visit(AstMemberSel* nodep) override { if (!nodep->user1()) { rename(nodep, false); iterateChildren(nodep); } } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { if (!nodep->user1SetOnce()) { if (nodep->aboveScopep()) iterate(nodep->aboveScopep()); if (nodep->aboveCellp()) iterate(nodep->aboveCellp()); @@ -130,12 +130,12 @@ private: } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit NameVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~NameVisitor() override = default; + ~NameVisitor() override = default; }; //###################################################################### diff --git a/src/V3OptionParser.cpp b/src/V3OptionParser.cpp index 8035916e7..1a1f7d84a 100644 --- a/src/V3OptionParser.cpp +++ b/src/V3OptionParser.cpp @@ -39,12 +39,12 @@ struct V3OptionParser::Impl { class ActionBase VL_NOT_FINAL : public ActionIfs { bool m_undocumented = false; // This option is not documented public: - virtual bool isValueNeeded() const override final { return MODE == en::VALUE; } - virtual bool isFOnOffAllowed() const override final { return MODE == en::FONOFF; } - virtual bool isOnOffAllowed() const override final { return MODE == en::ONOFF; } - virtual bool isPartialMatchAllowed() const override final { return ALLOW_PARTIAL_MATCH; } - virtual bool isUndocumented() const override { return m_undocumented; } - virtual void undocumented() override { m_undocumented = true; } + bool isValueNeeded() const override final { return MODE == en::VALUE; } + bool isFOnOffAllowed() const override final { return MODE == en::FONOFF; } + bool isOnOffAllowed() const override final { return MODE == en::ONOFF; } + bool isPartialMatchAllowed() const override final { return ALLOW_PARTIAL_MATCH; } + bool isUndocumented() const override { return m_undocumented; } + void undocumented() override { m_undocumented = true; } }; // Actual action classes @@ -78,7 +78,7 @@ struct V3OptionParser::Impl { public: \ explicit className(type* valp) \ : m_valp(valp) {} \ - virtual void exec(const char* optp, const char* argp) override { body; } \ + void exec(const char* optp, const char* argp) override { body; } \ } V3OPTION_PARSER_DEF_ACT_CLASS(ActionSet, bool, *m_valp = true, en::NONE); @@ -104,7 +104,7 @@ V3OPTION_PARSER_DEF_ACT_CLASS(ActionOnOff, VOptionBool, m_valp->setTrueOrFalse(! using CbType = std::function; \ explicit className(CbType cb) \ : m_cb(std::move(cb)) {} \ - virtual void exec(const char* optp, const char* argp) override { body; } \ + void exec(const char* optp, const char* argp) override { body; } \ } V3OPTION_PARSER_DEF_ACT_CB_CLASS(ActionCbCall, void(void), m_cb(), en::NONE); diff --git a/src/V3Order.cpp b/src/V3Order.cpp index 74e4aaf0a..3c0aee447 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -157,7 +157,7 @@ static bool isClockerAssignment(AstNodeAssign* nodep) { private: // METHODS VL_DEBUG_FUNC; // Declare debug() - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { if (const AstVarRef* const varrefp = VN_CAST(nodep->lhsp(), VarRef)) { if (varrefp->varp()->attrClocker() == VVarAttrClocker::CLOCKER_YES) { m_clkAss = true; @@ -166,8 +166,8 @@ static bool isClockerAssignment(AstNodeAssign* nodep) { } iterateChildren(nodep->rhsp()); } - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } } visitor; visitor.iterate(nodep); return visitor.m_clkAss; @@ -212,7 +212,7 @@ class OrderClkMarkVisitor final : public VNVisitor { // METHODS VL_DEBUG_FUNC; // Declare debug() - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { m_hasClk = false; m_inAss = true; m_childClkWidth = 0; @@ -236,7 +236,7 @@ class OrderClkMarkVisitor final : public VNVisitor { } } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (m_inAss && nodep->varp()->attrClocker() == VVarAttrClocker::CLOCKER_YES) { if (m_inClocked) { nodep->v3warn(CLKDATA, @@ -249,7 +249,7 @@ class OrderClkMarkVisitor final : public VNVisitor { } } } - virtual void visit(AstConcat* nodep) override { + void visit(AstConcat* nodep) override { if (m_inAss) { iterateAndNextNull(nodep->lhsp()); const int lw = m_childClkWidth; @@ -258,20 +258,20 @@ class OrderClkMarkVisitor final : public VNVisitor { m_childClkWidth = lw + rw; // Pass up } } - virtual void visit(AstNodeSel* nodep) override { + void visit(AstNodeSel* nodep) override { if (m_inAss) { iterateChildren(nodep); // Pass up result width if (m_childClkWidth > nodep->width()) m_childClkWidth = nodep->width(); } } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { if (m_inAss) { iterateChildren(nodep); if (m_childClkWidth > nodep->width()) m_childClkWidth = nodep->width(); } } - virtual void visit(AstReplicate* nodep) override { + void visit(AstReplicate* nodep) override { if (m_inAss) { iterateChildren(nodep); if (VN_IS(nodep->rhsp(), Const)) { @@ -281,12 +281,12 @@ class OrderClkMarkVisitor final : public VNVisitor { } } } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { m_inClocked = nodep->hasClocked(); iterateChildren(nodep); m_inClocked = false; } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } // CONSTRUCTORS explicit OrderClkMarkVisitor(AstNode* nodep) { @@ -295,7 +295,7 @@ class OrderClkMarkVisitor final : public VNVisitor { iterate(nodep); } while (m_newClkMarked); } - virtual ~OrderClkMarkVisitor() override = default; + ~OrderClkMarkVisitor() override = default; public: static void process(AstNetlist* nodep) { OrderClkMarkVisitor{nodep}; } @@ -416,19 +416,19 @@ class OrderBuildVisitor final : public VNVisitor { } // VISITORS - virtual void visit(AstSenTree* nodep) override { + void visit(AstSenTree* nodep) override { // This should only find the global AstSenTrees under the AstTopScope, which we ignore // here. We visit AstSenTrees separately when encountering the AstActive that references // them. UASSERT_OBJ(!m_scopep, nodep, "AstSenTrees should have been made global in V3ActiveTop"); } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { UASSERT_OBJ(!m_scopep, nodep, "Should not nest"); m_scopep = nodep; iterateChildren(nodep); m_scopep = nullptr; } - virtual void visit(AstActive* nodep) override { + void visit(AstActive* nodep) override { UASSERT_OBJ(!nodep->sensesStorep(), nodep, "AstSenTrees should have been made global in V3ActiveTop"); UASSERT_OBJ(m_scopep, nodep, "AstActive not under AstScope"); @@ -460,7 +460,7 @@ class OrderBuildVisitor final : public VNVisitor { m_activeSenVxp = nullptr; m_domainp = nullptr; } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { // As we explicitly not visit (see ignored nodes below) any subtree that is not relevant // for ordering, we should be able to assert this: UASSERT_OBJ(m_scopep, nodep, "AstVarRef not under scope"); @@ -635,7 +635,7 @@ class OrderBuildVisitor final : public VNVisitor { } } } - virtual void visit(AstDpiExportUpdated* nodep) override { + void visit(AstDpiExportUpdated* nodep) override { // This is under a logic block (AstAlways) sensitive to a change in the DPI export trigger. // We just need to add an edge to the enclosing logic vertex (the vertex for the // AstAlways). @@ -645,7 +645,7 @@ class OrderBuildVisitor final : public VNVisitor { nodep->unlinkFrBack(); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstCCall* nodep) override { + void visit(AstCCall* nodep) override { // Calls to 'context' imported DPI function may call DPI exported functions if (m_dpiExportTriggerVxp && nodep->funcp()->dpiImportWrapper() && nodep->funcp()->dpiContext()) { @@ -656,45 +656,45 @@ class OrderBuildVisitor final : public VNVisitor { } //--- Logic akin to SystemVerilog Processes (AstNodeProcedure) - virtual void visit(AstInitial* nodep) override { // + void visit(AstInitial* nodep) override { // iterateLogic(nodep); } - virtual void visit(AstInitialAutomatic* nodep) override { // + void visit(AstInitialAutomatic* nodep) override { // iterateLogic(nodep); } - virtual void visit(AstInitialStatic* nodep) override { // + void visit(AstInitialStatic* nodep) override { // iterateLogic(nodep); } - virtual void visit(AstAlways* nodep) override { // + void visit(AstAlways* nodep) override { // iterateLogic(nodep); } - virtual void visit(AstAlwaysPost* nodep) override { + void visit(AstAlwaysPost* nodep) override { UASSERT_OBJ(!m_inPost, nodep, "Should not nest"); m_inPost = true; iterateLogic(nodep); m_inPost = false; } - virtual void visit(AstAlwaysPostponed* nodep) override { + void visit(AstAlwaysPostponed* nodep) override { UASSERT_OBJ(!m_inPostponed, nodep, "Should not nest"); m_inPostponed = true; iterateLogic(nodep); m_inPostponed = false; } - virtual void visit(AstFinal* nodep) override { // LCOV_EXCL_START + void visit(AstFinal* nodep) override { // LCOV_EXCL_START nodep->v3fatalSrc("AstFinal should have been removed already"); } // LCOV_EXCL_STOP //--- Logic akin go SystemVerilog continuous assignments - virtual void visit(AstAssignAlias* nodep) override { // + void visit(AstAssignAlias* nodep) override { // iterateLogic(nodep); } - virtual void visit(AstAssignW* nodep) override { + void visit(AstAssignW* nodep) override { UASSERT_OBJ(!m_inClkAss, nodep, "Should not nest"); m_inClkAss = isClockerAssignment(nodep); iterateLogic(nodep); m_inClkAss = false; } - virtual void visit(AstAssignPre* nodep) override { + void visit(AstAssignPre* nodep) override { UASSERT_OBJ(!m_inClkAss && !m_inPre, nodep, "Should not nest"); m_inClkAss = isClockerAssignment(nodep); m_inPre = true; @@ -702,7 +702,7 @@ class OrderBuildVisitor final : public VNVisitor { m_inPre = false; m_inClkAss = false; } - virtual void visit(AstAssignPost* nodep) override { + void visit(AstAssignPost* nodep) override { UASSERT_OBJ(!m_inClkAss && !m_inPost, nodep, "Should not nest"); m_inClkAss = isClockerAssignment(nodep); m_inPost = true; @@ -712,21 +712,21 @@ class OrderBuildVisitor final : public VNVisitor { } //--- Verilator concoctions - virtual void visit(AstAlwaysPublic* nodep) override { // + void visit(AstAlwaysPublic* nodep) override { // iterateLogic(nodep); } - virtual void visit(AstCoverToggle* nodep) override { // + void visit(AstCoverToggle* nodep) override { // iterateLogic(nodep); } //--- Ignored nodes - virtual void visit(AstVar*) override {} - virtual void visit(AstVarScope* nodep) override {} - virtual void visit(AstCell*) override {} // Only interested in the respective AstScope - virtual void visit(AstTypeTable*) override {} - virtual void visit(AstConstPool*) override {} - virtual void visit(AstClass*) override {} - virtual void visit(AstCFunc*) override { + void visit(AstVar*) override {} + void visit(AstVarScope* nodep) override {} + void visit(AstCell*) override {} // Only interested in the respective AstScope + void visit(AstTypeTable*) override {} + void visit(AstConstPool*) override {} + void visit(AstClass*) override {} + void visit(AstCFunc*) override { // Calls to DPI exports handled with AstCCall. /* verilator public */ functions are // ignored for now (and hence potentially mis-ordered), but could use the same or // similar mechanism as DPI exports. Every other impure function (including those @@ -734,7 +734,7 @@ class OrderBuildVisitor final : public VNVisitor { } //--- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } // CONSTRUCTOR explicit OrderBuildVisitor(AstNetlist* nodep) { @@ -981,15 +981,14 @@ public: : m_pomGraphp{pomGraphp} , m_pomWaitingp{pomWaitingp} {} // METHODS - virtual OrderMoveVertex* makeVertexp(OrderLogicVertex* lvertexp, const OrderEitherVertex*, - const AstScope* scopep, - const AstSenTree* domainp) override { + OrderMoveVertex* makeVertexp(OrderLogicVertex* lvertexp, const OrderEitherVertex*, + const AstScope* scopep, const AstSenTree* domainp) override { OrderMoveVertex* const resultp = new OrderMoveVertex(m_pomGraphp, lvertexp); resultp->domScopep(OrderMoveDomScope::findCreate(domainp, scopep)); resultp->m_pomWaitingE.pushBack(*m_pomWaitingp, resultp); return resultp; } - virtual void freeVertexp(OrderMoveVertex* freeMep) override { + void freeVertexp(OrderMoveVertex* freeMep) override { freeMep->m_pomWaitingE.unlink(*m_pomWaitingp, freeMep); freeMep->unlinkDelete(m_pomGraphp); } @@ -1005,18 +1004,14 @@ class OrderMTaskMoveVertexMaker final public: explicit OrderMTaskMoveVertexMaker(V3Graph* pomGraphp) : m_pomGraphp{pomGraphp} {} - virtual MTaskMoveVertex* makeVertexp(OrderLogicVertex* lvertexp, - const OrderEitherVertex* varVertexp, - const AstScope* scopep, - const AstSenTree* domainp) override { + MTaskMoveVertex* makeVertexp(OrderLogicVertex* lvertexp, const OrderEitherVertex* varVertexp, + const AstScope* scopep, const AstSenTree* domainp) override { // Exclude initial/settle logic from the mtasks graph. // We'll output time-zero logic separately. if (domainp->hasInitial() || domainp->hasSettle()) return nullptr; return new MTaskMoveVertex(m_pomGraphp, lvertexp, varVertexp, scopep, domainp); } - virtual void freeVertexp(MTaskMoveVertex* freeMep) override { - freeMep->unlinkDelete(m_pomGraphp); - } + void freeVertexp(MTaskMoveVertex* freeMep) override { freeMep->unlinkDelete(m_pomGraphp); } private: VL_UNCOPYABLE(OrderMTaskMoveVertexMaker); diff --git a/src/V3OrderGraph.h b/src/V3OrderGraph.h index 2fb8c33ab..08c0a54e8 100644 --- a/src/V3OrderGraph.h +++ b/src/V3OrderGraph.h @@ -112,9 +112,9 @@ inline bool operator==(OrderVEdgeType::en lhs, const OrderVEdgeType& rhs) { class OrderGraph final : public V3Graph { public: OrderGraph() = default; - virtual ~OrderGraph() override = default; + ~OrderGraph() override = default; // Methods - virtual void loopsVertexCb(V3GraphVertex* vertexp) override; + void loopsVertexCb(V3GraphVertex* vertexp) override; }; //###################################################################### @@ -136,12 +136,12 @@ public: : V3GraphVertex{graphp} , m_scopep{scopep} , m_domainp{domainp} {} - virtual ~OrderEitherVertex() override = default; - virtual OrderEitherVertex* clone(V3Graph* graphp) const override = 0; + ~OrderEitherVertex() override = default; + OrderEitherVertex* clone(V3Graph* graphp) const override = 0; // Methods virtual OrderVEdgeType type() const = 0; virtual bool domainMatters() = 0; // Must be in same domain when cross edge to this vertex - virtual string dotName() const override { return cvtToHex(m_scopep) + "_"; } + string dotName() const override { return cvtToHex(m_scopep) + "_"; } // ACCESSORS void domainp(AstSenTree* domainp) { m_domainp = domainp; } AstScope* scopep() const { return m_scopep; } @@ -159,16 +159,16 @@ public: : OrderEitherVertex{graphp, nullptr, domainp} { isFromInput(true); // By definition } - virtual ~OrderInputsVertex() override = default; - virtual OrderInputsVertex* clone(V3Graph* graphp) const override { + ~OrderInputsVertex() override = default; + OrderInputsVertex* clone(V3Graph* graphp) const override { return new OrderInputsVertex(graphp, *this); } - virtual OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_INPUTS; } - virtual string name() const override { return "*INPUTS*"; } - virtual string dotColor() const override { return "green"; } - virtual string dotName() const override { return ""; } - virtual string dotShape() const override { return "invhouse"; } - virtual bool domainMatters() override { return false; } + OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_INPUTS; } + string name() const override { return "*INPUTS*"; } + string dotColor() const override { return "green"; } + string dotName() const override { return ""; } + string dotShape() const override { return "invhouse"; } + bool domainMatters() override { return false; } }; class OrderLogicVertex final : public OrderEitherVertex { @@ -183,20 +183,18 @@ public: OrderLogicVertex(V3Graph* graphp, AstScope* scopep, AstSenTree* domainp, AstNode* nodep) : OrderEitherVertex{graphp, scopep, domainp} , m_nodep{nodep} {} - virtual ~OrderLogicVertex() override = default; - virtual OrderLogicVertex* clone(V3Graph* graphp) const override { + ~OrderLogicVertex() override = default; + OrderLogicVertex* clone(V3Graph* graphp) const override { return new OrderLogicVertex(graphp, *this); } - virtual OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_LOGIC; } - virtual bool domainMatters() override { return true; } + OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_LOGIC; } + bool domainMatters() override { return true; } // ACCESSORS - virtual string name() const override { + string name() const override { return (cvtToHex(m_nodep) + "\\n " + cvtToStr(nodep()->typeName())); } AstNode* nodep() const { return m_nodep; } - virtual string dotShape() const override { - return VN_IS(m_nodep, Active) ? "doubleoctagon" : "rect"; - } + string dotShape() const override { return VN_IS(m_nodep, Active) ? "doubleoctagon" : "rect"; } }; class OrderVarVertex VL_NOT_FINAL : public OrderEitherVertex { @@ -214,17 +212,17 @@ public: OrderVarVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp) : OrderEitherVertex{graphp, scopep, nullptr} , m_varScp{varScp} {} - virtual ~OrderVarVertex() override = default; - virtual OrderVarVertex* clone(V3Graph* graphp) const override = 0; - virtual OrderVEdgeType type() const override = 0; - virtual FileLine* fileline() const override { return varScp()->fileline(); } + ~OrderVarVertex() override = default; + OrderVarVertex* clone(V3Graph* graphp) const override = 0; + OrderVEdgeType type() const override = 0; + FileLine* fileline() const override { return varScp()->fileline(); } // ACCESSORS AstVarScope* varScp() const { return m_varScp; } void isClock(bool flag) { m_isClock = flag; } bool isClock() const { return m_isClock; } void isDelayed(bool flag) { m_isDelayed = flag; } bool isDelayed() const { return m_isDelayed; } - virtual string dotShape() const override { return "ellipse"; } + string dotShape() const override { return "ellipse"; } }; class OrderVarStdVertex final : public OrderVarVertex { @@ -234,16 +232,14 @@ class OrderVarStdVertex final : public OrderVarVertex { public: OrderVarStdVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp) : OrderVarVertex{graphp, scopep, varScp} {} - virtual ~OrderVarStdVertex() override = default; - virtual OrderVarStdVertex* clone(V3Graph* graphp) const override { + ~OrderVarStdVertex() override = default; + OrderVarStdVertex* clone(V3Graph* graphp) const override { return new OrderVarStdVertex(graphp, *this); } - virtual OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_VARSTD; } - virtual string name() const override { - return (cvtToHex(varScp()) + "\\n " + varScp()->name()); - } - virtual string dotColor() const override { return "grey"; } - virtual bool domainMatters() override { return true; } + OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_VARSTD; } + string name() const override { return (cvtToHex(varScp()) + "\\n " + varScp()->name()); } + string dotColor() const override { return "grey"; } + bool domainMatters() override { return true; } }; class OrderVarPreVertex final : public OrderVarVertex { OrderVarPreVertex(V3Graph* graphp, const OrderVarPreVertex& old) @@ -252,16 +248,14 @@ class OrderVarPreVertex final : public OrderVarVertex { public: OrderVarPreVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp) : OrderVarVertex{graphp, scopep, varScp} {} - virtual ~OrderVarPreVertex() override = default; - virtual OrderVarPreVertex* clone(V3Graph* graphp) const override { + ~OrderVarPreVertex() override = default; + OrderVarPreVertex* clone(V3Graph* graphp) const override { return new OrderVarPreVertex(graphp, *this); } - virtual OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_VARPRE; } - virtual string name() const override { - return (cvtToHex(varScp()) + " PRE\\n " + varScp()->name()); - } - virtual string dotColor() const override { return "green"; } - virtual bool domainMatters() override { return false; } + OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_VARPRE; } + string name() const override { return (cvtToHex(varScp()) + " PRE\\n " + varScp()->name()); } + string dotColor() const override { return "green"; } + bool domainMatters() override { return false; } }; class OrderVarPostVertex final : public OrderVarVertex { OrderVarPostVertex(V3Graph* graphp, const OrderVarPostVertex& old) @@ -270,16 +264,14 @@ class OrderVarPostVertex final : public OrderVarVertex { public: OrderVarPostVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp) : OrderVarVertex{graphp, scopep, varScp} {} - virtual OrderVarPostVertex* clone(V3Graph* graphp) const override { + OrderVarPostVertex* clone(V3Graph* graphp) const override { return new OrderVarPostVertex(graphp, *this); } - virtual OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_VARPOST; } - virtual ~OrderVarPostVertex() override = default; - virtual string name() const override { - return (cvtToHex(varScp()) + " POST\\n " + varScp()->name()); - } - virtual string dotColor() const override { return "red"; } - virtual bool domainMatters() override { return false; } + OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_VARPOST; } + ~OrderVarPostVertex() override = default; + string name() const override { return (cvtToHex(varScp()) + " POST\\n " + varScp()->name()); } + string dotColor() const override { return "red"; } + bool domainMatters() override { return false; } }; class OrderVarPordVertex final : public OrderVarVertex { OrderVarPordVertex(V3Graph* graphp, const OrderVarPordVertex& old) @@ -288,16 +280,14 @@ class OrderVarPordVertex final : public OrderVarVertex { public: OrderVarPordVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp) : OrderVarVertex{graphp, scopep, varScp} {} - virtual ~OrderVarPordVertex() override = default; - virtual OrderVarPordVertex* clone(V3Graph* graphp) const override { + ~OrderVarPordVertex() override = default; + OrderVarPordVertex* clone(V3Graph* graphp) const override { return new OrderVarPordVertex(graphp, *this); } - virtual OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_VARPORD; } - virtual string name() const override { - return (cvtToHex(varScp()) + " PORD\\n " + varScp()->name()); - } - virtual string dotColor() const override { return "blue"; } - virtual bool domainMatters() override { return false; } + OrderVEdgeType type() const override { return OrderVEdgeType::VERTEX_VARPORD; } + string name() const override { return (cvtToHex(varScp()) + " PORD\\n " + varScp()->name()); } + string dotColor() const override { return "blue"; } + bool domainMatters() override { return false; } }; //###################################################################### @@ -324,28 +314,28 @@ public: , m_logicp{logicp} , m_state{POM_WAIT} , m_domScopep{nullptr} {} - virtual ~OrderMoveVertex() override = default; - virtual OrderMoveVertex* clone(V3Graph* graphp) const override { + ~OrderMoveVertex() override = default; + OrderMoveVertex* clone(V3Graph* graphp) const override { v3fatalSrc("Unsupported"); return nullptr; } // METHODS virtual OrderVEdgeType type() const { return OrderVEdgeType::VERTEX_MOVE; } - virtual string dotColor() const override { + string dotColor() const override { if (logicp()) { return logicp()->dotColor(); } else { return ""; } } - virtual FileLine* fileline() const override { + FileLine* fileline() const override { if (logicp()) { return logicp()->fileline(); } else { return nullptr; } } - virtual string name() const override { + string name() const override { string nm; if (VL_UNCOVERABLE(!logicp())) { // Avoid crash when debugging nm = "nul"; // LCOV_EXCL_LINE @@ -394,20 +384,20 @@ public: , m_domainp{domainp} { UASSERT(!(logicp && varp), "MTaskMoveVertex: logicp and varp may not both be set!\n"); } - virtual ~MTaskMoveVertex() override = default; - virtual MTaskMoveVertex* clone(V3Graph* graphp) const override { + ~MTaskMoveVertex() override = default; + MTaskMoveVertex* clone(V3Graph* graphp) const override { v3fatalSrc("Unsupported"); return nullptr; } virtual OrderVEdgeType type() const { return OrderVEdgeType::VERTEX_MOVE; } - virtual string dotColor() const override { + string dotColor() const override { if (logicp()) { return logicp()->dotColor(); } else { return "yellow"; } } - virtual string name() const override { + string name() const override { string nm; if (logicp()) { nm = logicp()->name(); @@ -439,10 +429,9 @@ public: OrderEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top, int weight, bool cutable = false) : V3GraphEdge{graphp, fromp, top, weight, cutable} {} - virtual ~OrderEdge() override = default; + ~OrderEdge() override = default; virtual OrderVEdgeType type() const { return OrderVEdgeType::EDGE_STD; } - virtual OrderEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, - V3GraphVertex* top) const override { + OrderEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) const override { return new OrderEdge(graphp, fromp, top, *this); } // When ordering combo blocks with stronglyConnected, follow edges not @@ -466,14 +455,14 @@ class OrderComboCutEdge final : public OrderEdge { public: OrderComboCutEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) : OrderEdge{graphp, fromp, top, WEIGHT_COMBO, CUTABLE} {} - virtual OrderVEdgeType type() const override { return OrderVEdgeType::EDGE_COMBOCUT; } - virtual ~OrderComboCutEdge() override = default; - virtual OrderComboCutEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, - V3GraphVertex* top) const override { + OrderVEdgeType type() const override { return OrderVEdgeType::EDGE_COMBOCUT; } + ~OrderComboCutEdge() override = default; + OrderComboCutEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, + V3GraphVertex* top) const override { return new OrderComboCutEdge(graphp, fromp, top, *this); } - virtual string dotColor() const override { return "yellowGreen"; } - virtual bool followComboConnected() const override { return true; } + string dotColor() const override { return "yellowGreen"; } + bool followComboConnected() const override { return true; } }; class OrderPostCutEdge final : public OrderEdge { @@ -487,14 +476,14 @@ class OrderPostCutEdge final : public OrderEdge { public: OrderPostCutEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) : OrderEdge{graphp, fromp, top, WEIGHT_COMBO, CUTABLE} {} - virtual OrderVEdgeType type() const override { return OrderVEdgeType::EDGE_POSTCUT; } - virtual ~OrderPostCutEdge() override = default; - virtual OrderPostCutEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, - V3GraphVertex* top) const override { + OrderVEdgeType type() const override { return OrderVEdgeType::EDGE_POSTCUT; } + ~OrderPostCutEdge() override = default; + OrderPostCutEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, + V3GraphVertex* top) const override { return new OrderPostCutEdge(graphp, fromp, top, *this); } - virtual string dotColor() const override { return "PaleGreen"; } - virtual bool followComboConnected() const override { return false; } + string dotColor() const override { return "PaleGreen"; } + bool followComboConnected() const override { return false; } }; class OrderPreCutEdge final : public OrderEdge { @@ -508,14 +497,14 @@ class OrderPreCutEdge final : public OrderEdge { public: OrderPreCutEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) : OrderEdge{graphp, fromp, top, WEIGHT_PRE, CUTABLE} {} - virtual OrderVEdgeType type() const override { return OrderVEdgeType::EDGE_PRECUT; } - virtual OrderPreCutEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, - V3GraphVertex* top) const override { + OrderVEdgeType type() const override { return OrderVEdgeType::EDGE_PRECUT; } + OrderPreCutEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, + V3GraphVertex* top) const override { return new OrderPreCutEdge(graphp, fromp, top, *this); } - virtual ~OrderPreCutEdge() override = default; - virtual string dotColor() const override { return "khaki"; } - virtual bool followComboConnected() const override { return false; } + ~OrderPreCutEdge() override = default; + string dotColor() const override { return "khaki"; } + bool followComboConnected() const override { return false; } }; #endif // Guard diff --git a/src/V3Param.cpp b/src/V3Param.cpp index 01807114f..3a21266fc 100644 --- a/src/V3Param.cpp +++ b/src/V3Param.cpp @@ -977,7 +977,7 @@ class ParamVisitor final : public VNVisitor { } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { if (nodep->recursiveClone()) nodep->dead(true); // Fake, made for recursive elimination if (nodep->dead()) return; // Marked by LinkDot (and above) @@ -995,14 +995,14 @@ class ParamVisitor final : public VNVisitor { } } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { visitCellOrClassRef(nodep, VN_IS(nodep->modp(), Iface)); } - virtual void visit(AstClassRefDType* nodep) override { visitCellOrClassRef(nodep, false); } - virtual void visit(AstClassOrPackageRef* nodep) override { visitCellOrClassRef(nodep, false); } + void visit(AstClassRefDType* nodep) override { visitCellOrClassRef(nodep, false); } + void visit(AstClassOrPackageRef* nodep) override { visitCellOrClassRef(nodep, false); } // Make sure all parameters are constantified - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { if (nodep->user5SetOnce()) return; // Process once iterateChildren(nodep); if (nodep->isParam()) { @@ -1015,7 +1015,7 @@ class ParamVisitor final : public VNVisitor { } } // Make sure varrefs cause vars to constify before things above - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { // Might jump across functions, so beware if ever add a m_funcp if (nodep->varp()) iterate(nodep->varp()); } @@ -1036,7 +1036,7 @@ class ParamVisitor final : public VNVisitor { } return false; } - virtual void visit(AstVarXRef* nodep) override { + void visit(AstVarXRef* nodep) override { // Check to see if the scope is just an interface because interfaces are special const string dotted = nodep->dotted(); if (!dotted.empty() && nodep->varp() && nodep->varp()->isParam()) { @@ -1082,7 +1082,7 @@ class ParamVisitor final : public VNVisitor { nodep->varp(nullptr); // Needs relink, as may remove pointed-to var } - virtual void visit(AstUnlinkedRef* nodep) override { + void visit(AstUnlinkedRef* nodep) override { AstVarXRef* const varxrefp = VN_CAST(nodep->op1p(), VarXRef); AstNodeFTaskRef* const taskrefp = VN_CAST(nodep->op1p(), NodeFTaskRef); if (varxrefp) { @@ -1103,7 +1103,7 @@ class ParamVisitor final : public VNVisitor { nodep->replaceWith(nodep->op1p()->unlinkFrBack()); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstCellArrayRef* nodep) override { + void visit(AstCellArrayRef* nodep) override { V3Const::constifyParamsEdit(nodep->selp()); if (const AstConst* const constp = VN_CAST(nodep->selp(), Const)) { const string index = AstNode::encodeNumber(constp->toSInt()); @@ -1122,7 +1122,7 @@ class ParamVisitor final : public VNVisitor { } // Generate Statements - virtual void visit(AstGenIf* nodep) override { + void visit(AstGenIf* nodep) override { UINFO(9, " GENIF " << nodep << endl); iterateAndNextNull(nodep->condp()); // We suppress errors when widthing params since short-circuiting in @@ -1149,7 +1149,7 @@ class ParamVisitor final : public VNVisitor { //! @todo Unlike generated IF, we don't have to worry about short-circuiting the conditional //! expression, since this is currently restricted to simple comparisons. If we ever do //! move to more generic constant expressions, such code will be needed here. - virtual void visit(AstBegin* nodep) override { + void visit(AstBegin* nodep) override { if (nodep->genforp()) { AstGenFor* const forp = VN_AS(nodep->genforp(), GenFor); UASSERT_OBJ(forp, nodep, "Non-GENFOR under generate-for BEGIN"); @@ -1181,10 +1181,10 @@ class ParamVisitor final : public VNVisitor { iterateChildren(nodep); } } - virtual void visit(AstGenFor* nodep) override { // LCOV_EXCL_LINE + void visit(AstGenFor* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc("GENFOR should have been wrapped in BEGIN"); } - virtual void visit(AstGenCase* nodep) override { + void visit(AstGenCase* nodep) override { UINFO(9, " GENCASE " << nodep << endl); AstNode* keepp = nullptr; iterateAndNextNull(nodep->exprp()); @@ -1235,7 +1235,7 @@ class ParamVisitor final : public VNVisitor { VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -1272,7 +1272,7 @@ public: for (AstNodeModule* const modp : modps) netlistp->addModulep(modp); } } - virtual ~ParamVisitor() override = default; + ~ParamVisitor() override = default; VL_UNCOPYABLE(ParamVisitor); }; diff --git a/src/V3Partition.cpp b/src/V3Partition.cpp index a2978e93a..f3ffaf56b 100644 --- a/src/V3Partition.cpp +++ b/src/V3Partition.cpp @@ -253,7 +253,7 @@ public: m_vertices.splice(m_vertices.end(), otherp->m_vertices); m_cost += otherp->m_cost; } - virtual const VxList* vertexListp() const override { return &m_vertices; } + const VxList* vertexListp() const override { return &m_vertices; } static uint64_t incGeneration() { static uint64_t s_generation = 0; ++s_generation; @@ -263,10 +263,10 @@ public: // Use this instead of pointer-compares to compare LogicMTasks. Avoids // nondeterministic output. Also name mtasks based on this number in // the final C++ output. - virtual uint32_t id() const override { return m_serialId; } + uint32_t id() const override { return m_serialId; } void id(uint32_t id) { m_serialId = id; } // Abstract cost of every logic mtask - virtual uint32_t cost() const override { return m_cost; } + uint32_t cost() const override { return m_cost; } void setCost(uint32_t cost) { m_cost = cost; } // For tests only uint32_t stepCost() const { return stepCost(m_cost); } static uint32_t stepCost(uint32_t cost) { @@ -319,7 +319,7 @@ public: void checkRelativesCp(GraphWay way) const; - virtual string name() const override { + string name() const override { // Display forward and reverse critical path costs. This gives a quick // read on whether graph partitioning looks reasonable or bad. std::ostringstream out; @@ -1850,7 +1850,7 @@ private: // METHODS VL_DEBUG_FUNC; - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { if (!m_tracingCall) return; m_tracingCall = false; if (nodep->dpiImportWrapper()) { @@ -1861,19 +1861,19 @@ private: } iterateChildren(nodep); } - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { iterateChildren(nodep); // Enter the function and trace it m_tracingCall = true; iterate(nodep->funcp()); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit DpiImportCallVisitor(AstNode* nodep) { iterate(nodep); } bool hasDpiHazard() const { return m_hasDpiHazard; } - virtual ~DpiImportCallVisitor() override = default; + ~DpiImportCallVisitor() override = default; private: VL_UNCOPYABLE(DpiImportCallVisitor); diff --git a/src/V3PartitionGraph.h b/src/V3PartitionGraph.h index b0eac05d3..d8ed603af 100644 --- a/src/V3PartitionGraph.h +++ b/src/V3PartitionGraph.h @@ -32,7 +32,7 @@ class AbstractMTask VL_NOT_FINAL : public V3GraphVertex { public: explicit AbstractMTask(V3Graph* graphp) : V3GraphVertex{graphp} {} - virtual ~AbstractMTask() override = default; + ~AbstractMTask() override = default; virtual uint32_t id() const = 0; virtual uint32_t cost() const = 0; }; @@ -44,12 +44,12 @@ public: // CONSTRUCTORS explicit AbstractLogicMTask(V3Graph* graphp) : AbstractMTask{graphp} {} - virtual ~AbstractLogicMTask() override = default; + ~AbstractLogicMTask() override = default; // METHODS // Set of logic vertices in this mtask. Order is not significant. virtual const VxList* vertexListp() const = 0; - virtual uint32_t id() const override = 0; // Unique id of this mtask. - virtual uint32_t cost() const override = 0; + uint32_t id() const override = 0; // Unique id of this mtask. + uint32_t cost() const override = 0; }; class ExecMTask final : public AbstractMTask { @@ -72,10 +72,10 @@ public: , m_bodyp{bodyp} , m_id{id} {} AstMTaskBody* bodyp() const { return m_bodyp; } - virtual uint32_t id() const override { return m_id; } + uint32_t id() const override { return m_id; } uint32_t priority() const { return m_priority; } void priority(uint32_t pri) { m_priority = pri; } - virtual uint32_t cost() const override { return m_cost; } + uint32_t cost() const override { return m_cost; } void cost(uint32_t cost) { m_cost = cost; } void predictStart(uint64_t time) { m_predictStart = time; } uint64_t predictStart() const { return m_predictStart; } @@ -85,7 +85,7 @@ public: // If this MTask maps to a C function, this should be the name return std::string{"__Vmtask"} + "__" + cvtToStr(m_id); } - virtual string name() const override { return std::string{"mt"} + cvtToStr(id()); } + string name() const override { return std::string{"mt"} + cvtToStr(id()); } string hashName() const { return m_hashName; } void hashName(const string& name) { m_hashName = name; } void dump(std::ostream& str) const { diff --git a/src/V3PreProc.cpp b/src/V3PreProc.cpp index 0cf66dc24..684733a6e 100644 --- a/src/V3PreProc.cpp +++ b/src/V3PreProc.cpp @@ -250,13 +250,13 @@ public: void candidateDefines(VSpellCheck* spellerp) override; // METHODS, callbacks - virtual void comment(const string& text) override; // Comment detected (if keepComments==2) - virtual void include(const string& filename) override; // Request a include file be processed - virtual void undef(const string& name) override; + void comment(const string& text) override; // Comment detected (if keepComments==2) + void include(const string& filename) override; // Request a include file be processed + void undef(const string& name) override; virtual void undefineall(); - virtual void define(FileLine* fl, const string& name, const string& value, - const string& params, bool cmdline) override; - virtual string removeDefines(const string& text) override; // Remove defines in a text string + void define(FileLine* fl, const string& name, const string& value, const string& params, + bool cmdline) override; + string removeDefines(const string& text) override; // Remove defines in a text string // CONSTRUCTORS V3PreProcImp() { diff --git a/src/V3Premit.cpp b/src/V3Premit.cpp index e10f13458..842b8d720 100644 --- a/src/V3Premit.cpp +++ b/src/V3Premit.cpp @@ -151,11 +151,11 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { UINFO(4, " MOD " << nodep << endl); iterateChildren(nodep); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { VL_RESTORER(m_cfuncp); { m_cfuncp = nodep; @@ -167,7 +167,7 @@ private: m_assignLhs = false; if (m_cfuncp) m_stmtp = nodep; } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { UINFO(4, " WHILE " << nodep << endl); startStatement(nodep); iterateAndNextNull(nodep->precondsp()); @@ -180,7 +180,7 @@ private: iterateAndNextNull(nodep->incsp()); m_stmtp = nullptr; } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { startStatement(nodep); { bool noopt = false; @@ -207,7 +207,7 @@ private: m_assignLhs = false; m_stmtp = nullptr; } - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { if (!nodep->isStatement()) { iterateChildren(nodep); return; @@ -217,7 +217,7 @@ private: iterateChildren(nodep); m_stmtp = nullptr; } - virtual void visit(AstTraceInc* nodep) override { + void visit(AstTraceInc* nodep) override { startStatement(nodep); m_inTracep = nodep; iterateChildren(nodep); @@ -271,31 +271,31 @@ private: iterateChildren(nodep); checkNode(nodep); } - virtual void visit(AstShiftL* nodep) override { visitShift(nodep); } - virtual void visit(AstShiftR* nodep) override { visitShift(nodep); } - virtual void visit(AstShiftRS* nodep) override { visitShift(nodep); } + void visit(AstShiftL* nodep) override { visitShift(nodep); } + void visit(AstShiftR* nodep) override { visitShift(nodep); } + void visit(AstShiftRS* nodep) override { visitShift(nodep); } // Operators - virtual void visit(AstNodeTermop* nodep) override { + void visit(AstNodeTermop* nodep) override { iterateChildren(nodep); checkNode(nodep); } - virtual void visit(AstNodeUniop* nodep) override { + void visit(AstNodeUniop* nodep) override { iterateChildren(nodep); checkNode(nodep); } - virtual void visit(AstNodeBiop* nodep) override { + void visit(AstNodeBiop* nodep) override { iterateChildren(nodep); checkNode(nodep); } - virtual void visit(AstRand* nodep) override { + void visit(AstRand* nodep) override { iterateChildren(nodep); checkNode(nodep); } - virtual void visit(AstUCFunc* nodep) override { + void visit(AstUCFunc* nodep) override { iterateChildren(nodep); checkNode(nodep); } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { iterateAndNextNull(nodep->fromp()); { // Only the 'from' is part of the assignment LHS VL_RESTORER(m_assignLhs); @@ -305,7 +305,7 @@ private: } checkNode(nodep); } - virtual void visit(AstArraySel* nodep) override { + void visit(AstArraySel* nodep) override { iterateAndNextNull(nodep->fromp()); { // Only the 'from' is part of the assignment LHS VL_RESTORER(m_assignLhs); @@ -314,7 +314,7 @@ private: } checkNode(nodep); } - virtual void visit(AstAssocSel* nodep) override { + void visit(AstAssocSel* nodep) override { iterateAndNextNull(nodep->fromp()); { // Only the 'from' is part of the assignment LHS VL_RESTORER(m_assignLhs); @@ -323,11 +323,11 @@ private: } checkNode(nodep); } - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { iterateChildren(nodep); checkNode(nodep); } - virtual void visit(AstNodeCond* nodep) override { + void visit(AstNodeCond* nodep) override { iterateChildren(nodep); if (nodep->expr1p()->isWide() && !VN_IS(nodep->condp(), Const) && !VN_IS(nodep->condp(), VarRef)) { @@ -339,7 +339,7 @@ private: } // Autoflush - virtual void visit(AstDisplay* nodep) override { + void visit(AstDisplay* nodep) override { startStatement(nodep); iterateChildren(nodep); m_stmtp = nullptr; @@ -356,7 +356,7 @@ private: } } } - virtual void visit(AstSFormatF* nodep) override { + void visit(AstSFormatF* nodep) override { iterateChildren(nodep); // Any strings sent to a display must be var of string data type, // to avoid passing a pointer to a temporary. @@ -370,8 +370,8 @@ private: //-------------------- // Default: Just iterate - virtual void visit(AstVar*) override {} // Don't hit varrefs under vars - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} // Don't hit varrefs under vars + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS diff --git a/src/V3ProtectLib.cpp b/src/V3ProtectLib.cpp index c9a7acf9b..21abed5a7 100644 --- a/src/V3ProtectLib.cpp +++ b/src/V3ProtectLib.cpp @@ -64,7 +64,7 @@ private: bool m_hasClk = false; // True if the top module has sequential logic // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { m_vfilep = new AstVFile{nodep->fileline(), v3Global.opt.makeDir() + "/" + m_libName + ".sv"}; nodep->addFilesp(m_vfilep); @@ -74,7 +74,7 @@ private: iterateChildren(nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { if (!nodep->isTop()) { return; } else { @@ -422,7 +422,7 @@ private: m_cfilep->tblockp(txtp); } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { if (!nodep->isIO()) return; if (nodep->direction() == VDirection::INPUT) { if (nodep->isUsedClock() || nodep->attrClocker() == VVarAttrClocker::CLOCKER_YES) { @@ -439,7 +439,7 @@ private: } } - virtual void visit(AstNode*) override {} + void visit(AstNode*) override {} string cInputConnection(AstVar* varp) { return V3Task::assignDpiToInternal("handlep__V->" + varp->name(), varp); diff --git a/src/V3Randomize.cpp b/src/V3Randomize.cpp index 0ac20c3b7..448623a08 100644 --- a/src/V3Randomize.cpp +++ b/src/V3Randomize.cpp @@ -82,7 +82,7 @@ private: } // VISITORS - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { iterateChildren(nodep); if (nodep->extendsp()) { // Save pointer to derived class @@ -90,7 +90,7 @@ private: m_baseToDerivedMap[basep].insert(nodep); } } - virtual void visit(AstMethodCall* nodep) override { + void visit(AstMethodCall* nodep) override { iterateChildren(nodep); if (nodep->name() != "randomize") return; if (const AstClassRefDType* const classRefp @@ -100,7 +100,7 @@ private: markMembers(classp); } } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -108,7 +108,7 @@ public: iterate(nodep); markAllDerived(); } - virtual ~RandomizeMarkVisitor() override = default; + ~RandomizeMarkVisitor() override = default; }; //###################################################################### @@ -199,7 +199,7 @@ private: } // VISITORS - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { iterateChildren(nodep); if (!nodep->user1()) return; // Doesn't need randomize, or already processed UINFO(9, "Define randomize() for " << nodep << endl); @@ -241,12 +241,12 @@ private: } nodep->user1(false); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit RandomizeVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~RandomizeVisitor() override = default; + ~RandomizeVisitor() override = default; }; //###################################################################### diff --git a/src/V3Reloop.cpp b/src/V3Reloop.cpp index 19a4363ca..e163bdf8c 100644 --- a/src/V3Reloop.cpp +++ b/src/V3Reloop.cpp @@ -151,7 +151,7 @@ private: } // VISITORS - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { VL_RESTORER(m_cfuncp); { m_cfuncp = nodep; @@ -159,7 +159,7 @@ private: mergeEnd(); // Finish last pending merge, if any } } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { if (!m_cfuncp) return; // Left select WordSel or ArraySel @@ -250,14 +250,14 @@ private: UINFO(9, "Start merge i=" << lindex << " o=" << m_mgOffset << nodep << endl); } //-------------------- - virtual void visit(AstVar*) override {} // Accelerate - virtual void visit(AstNodeMath*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar*) override {} // Accelerate + void visit(AstNodeMath*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit ReloopVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~ReloopVisitor() override { + ~ReloopVisitor() override { V3Stats::addStat("Optimizations, Reloops", m_statReloops); V3Stats::addStat("Optimizations, Reloop iterations", m_statReItems); } diff --git a/src/V3Scope.cpp b/src/V3Scope.cpp index e39c1aa93..0c4bad466 100644 --- a/src/V3Scope.cpp +++ b/src/V3Scope.cpp @@ -81,7 +81,7 @@ private: } // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { AstNodeModule* const modp = nodep->topModulep(); if (!modp) { nodep->v3error("No top level module found"); @@ -93,7 +93,7 @@ private: iterate(modp); cleanupVarRefs(); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { // Create required blocks and add to module string scopename; if (!m_aboveScopep) { @@ -144,7 +144,7 @@ private: // ***Note m_scopep is passed back to the caller of the routine (above) } - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { // Create required blocks and add to module VL_RESTORER(m_scopep); VL_RESTORER(m_aboveCellp); @@ -177,13 +177,13 @@ private: iterateChildren(nodep); } } - virtual void visit(AstCellInline* nodep) override { // + void visit(AstCellInline* nodep) override { // nodep->scopep(m_scopep); } - virtual void visit(AstActive* nodep) override { // LCOV_EXCL_LINE + void visit(AstActive* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc("Actives now made after scoping"); } - virtual void visit(AstNodeProcedure* nodep) override { + void visit(AstNodeProcedure* nodep) override { // Add to list of blocks under this scope UINFO(4, " Move " << nodep << endl); AstNode* const clonep = nodep->cloneTree(false); @@ -191,7 +191,7 @@ private: m_scopep->addActivep(clonep); iterateChildren(clonep); // We iterate under the *clone* } - virtual void visit(AstAssignAlias* nodep) override { + void visit(AstAssignAlias* nodep) override { // Add to list of blocks under this scope UINFO(4, " Move " << nodep << endl); AstNode* const clonep = nodep->cloneTree(false); @@ -199,7 +199,7 @@ private: m_scopep->addActivep(clonep); iterateChildren(clonep); // We iterate under the *clone* } - virtual void visit(AstAssignVarScope* nodep) override { + void visit(AstAssignVarScope* nodep) override { // Copy under the scope but don't recurse UINFO(4, " Move " << nodep << endl); AstNode* const clonep = nodep->cloneTree(false); @@ -207,7 +207,7 @@ private: m_scopep->addActivep(clonep); iterateChildren(clonep); // We iterate under the *clone* } - virtual void visit(AstAssignW* nodep) override { + void visit(AstAssignW* nodep) override { // Add to list of blocks under this scope UINFO(4, " Move " << nodep << endl); AstNode* const clonep = nodep->cloneTree(false); @@ -215,7 +215,7 @@ private: m_scopep->addActivep(clonep); iterateChildren(clonep); // We iterate under the *clone* } - virtual void visit(AstAlwaysPublic* nodep) override { + void visit(AstAlwaysPublic* nodep) override { // Add to list of blocks under this scope UINFO(4, " Move " << nodep << endl); AstNode* const clonep = nodep->cloneTree(false); @@ -223,7 +223,7 @@ private: m_scopep->addActivep(clonep); iterateChildren(clonep); // We iterate under the *clone* } - virtual void visit(AstCoverToggle* nodep) override { + void visit(AstCoverToggle* nodep) override { // Add to list of blocks under this scope UINFO(4, " Move " << nodep << endl); AstNode* const clonep = nodep->cloneTree(false); @@ -231,7 +231,7 @@ private: m_scopep->addActivep(clonep); iterateChildren(clonep); // We iterate under the *clone* } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { // Add to list of blocks under this scope UINFO(4, " CFUNC " << nodep << endl); AstCFunc* const clonep = nodep->cloneTree(false); @@ -241,7 +241,7 @@ private: // We iterate under the *clone* iterateChildren(clonep); } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { // Add to list of blocks under this scope UINFO(4, " FTASK " << nodep << endl); AstNodeFTask* clonep; @@ -257,7 +257,7 @@ private: // We iterate under the *clone* iterateChildren(clonep); } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { // Make new scope variable if (!nodep->user1p()) { AstVarScope* const varscp = new AstVarScope(nodep->fileline(), m_scopep, nodep); @@ -275,7 +275,7 @@ private: m_scopep->addVarp(varscp); } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { // VarRef needs to point to VarScope // Make sure variable has made user1p. UASSERT_OBJ(nodep->varp(), nodep, "Unlinked"); @@ -289,7 +289,7 @@ private: m_varRefScopes.emplace(nodep, m_scopep); } } - virtual void visit(AstScopeName* nodep) override { + void visit(AstScopeName* nodep) override { // If there's a %m in the display text, we add a special node that will contain the name() const string prefix = std::string{"__DOT__"} + m_scopep->name(); // TOP and above will be the user's name(). @@ -305,17 +305,17 @@ private: if (afterp) nodep->scopeEntrp(afterp); iterateChildren(nodep); } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { // Scope that was made by this module for different cell; // Want to ignore blocks under it, so just do nothing } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit ScopeVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~ScopeVisitor() override = default; + ~ScopeVisitor() override = default; }; //###################################################################### @@ -330,7 +330,7 @@ private: VL_DEBUG_FUNC; // Declare debug() // VISITORS - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { // Want to ignore blocks under it VL_RESTORER(m_scopep); { @@ -351,20 +351,20 @@ private: } } - virtual void visit(AstNodeProcedure* nodep) override { movedDeleteOrIterate(nodep); } - virtual void visit(AstAssignAlias* nodep) override { movedDeleteOrIterate(nodep); } - virtual void visit(AstAssignVarScope* nodep) override { movedDeleteOrIterate(nodep); } - virtual void visit(AstAssignW* nodep) override { movedDeleteOrIterate(nodep); } - virtual void visit(AstAlwaysPublic* nodep) override { movedDeleteOrIterate(nodep); } - virtual void visit(AstCoverToggle* nodep) override { movedDeleteOrIterate(nodep); } - virtual void visit(AstNodeFTask* nodep) override { movedDeleteOrIterate(nodep); } - virtual void visit(AstCFunc* nodep) override { movedDeleteOrIterate(nodep); } + void visit(AstNodeProcedure* nodep) override { movedDeleteOrIterate(nodep); } + void visit(AstAssignAlias* nodep) override { movedDeleteOrIterate(nodep); } + void visit(AstAssignVarScope* nodep) override { movedDeleteOrIterate(nodep); } + void visit(AstAssignW* nodep) override { movedDeleteOrIterate(nodep); } + void visit(AstAlwaysPublic* nodep) override { movedDeleteOrIterate(nodep); } + void visit(AstCoverToggle* nodep) override { movedDeleteOrIterate(nodep); } + void visit(AstNodeFTask* nodep) override { movedDeleteOrIterate(nodep); } + void visit(AstCFunc* nodep) override { movedDeleteOrIterate(nodep); } - virtual void visit(AstVarXRef* nodep) override { + void visit(AstVarXRef* nodep) override { // The crossrefs are dealt with in V3LinkDot nodep->varp(nullptr); } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { // The crossrefs are dealt with in V3LinkDot UINFO(9, " Old pkg-taskref " << nodep << endl); if (nodep->classOrPackagep()) { @@ -380,7 +380,7 @@ private: } iterateChildren(nodep); } - virtual void visit(AstModportFTaskRef* nodep) override { + void visit(AstModportFTaskRef* nodep) override { // The modport persists only for xml dump // The crossrefs are dealt with in V3LinkDot nodep->ftaskp(nullptr); @@ -388,12 +388,12 @@ private: } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit ScopeCleanupVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~ScopeCleanupVisitor() override = default; + ~ScopeCleanupVisitor() override = default; }; //###################################################################### diff --git a/src/V3Simulate.h b/src/V3Simulate.h index 17f22e127..98d44a3c8 100644 --- a/src/V3Simulate.h +++ b/src/V3Simulate.h @@ -397,15 +397,15 @@ private: } // VISITORS - virtual void visit(AstAlways* nodep) override { + void visit(AstAlways* nodep) override { if (jumpingOver(nodep)) return; checkNodeInfo(nodep); iterateChildren(nodep); } - virtual void visit(AstSenTree* nodep) override { + void visit(AstSenTree* nodep) override { // Sensitivities aren't inputs per se; we'll keep our tree under the same sens. } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (jumpingOver(nodep)) return; if (!optimizable()) return; // Accelerate UASSERT_OBJ(nodep->varp(), nodep, "Unlinked"); @@ -473,7 +473,7 @@ private: } } } - virtual void visit(AstVarXRef* nodep) override { + void visit(AstVarXRef* nodep) override { if (jumpingOver(nodep)) return; if (m_scoped) { badNodeType(nodep); @@ -483,7 +483,7 @@ private: "allowed in constant functions"); } } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { if (jumpingOver(nodep)) return; if (!m_params) { badNodeType(nodep); @@ -503,7 +503,7 @@ private: checkNodeInfo(nodep); iterateChildren(nodep); } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { if (jumpingOver(nodep)) return; UINFO(5, " IF " << nodep << endl); checkNodeInfo(nodep); @@ -520,15 +520,15 @@ private: } } } - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { checkNodeInfo(nodep); if (!m_checkOnly && optimizable()) newValue(nodep, nodep); } - virtual void visit(AstInitArray* nodep) override { + void visit(AstInitArray* nodep) override { checkNodeInfo(nodep); if (!m_checkOnly && optimizable()) newValue(nodep, nodep); } - virtual void visit(AstEnumItemRef* nodep) override { + void visit(AstEnumItemRef* nodep) override { checkNodeInfo(nodep); UASSERT_OBJ(nodep->itemp(), nodep, "Not linked"); if (!m_checkOnly && optimizable()) { @@ -541,7 +541,7 @@ private: } } } - virtual void visit(AstNodeUniop* nodep) override { + void visit(AstNodeUniop* nodep) override { if (!optimizable()) return; // Accelerate checkNodeInfo(nodep); iterateChildren(nodep); @@ -549,7 +549,7 @@ private: nodep->numberOperate(newConst(nodep)->num(), fetchConst(nodep->lhsp())->num()); } } - virtual void visit(AstNodeBiop* nodep) override { + void visit(AstNodeBiop* nodep) override { if (!optimizable()) return; // Accelerate checkNodeInfo(nodep); iterateChildren(nodep); @@ -558,7 +558,7 @@ private: fetchConst(nodep->rhsp())->num()); } } - virtual void visit(AstNodeTriop* nodep) override { + void visit(AstNodeTriop* nodep) override { if (!optimizable()) return; // Accelerate checkNodeInfo(nodep); iterateChildren(nodep); @@ -568,7 +568,7 @@ private: fetchConst(nodep->thsp())->num()); } } - virtual void visit(AstNodeQuadop* nodep) override { + void visit(AstNodeQuadop* nodep) override { if (!optimizable()) return; // Accelerate checkNodeInfo(nodep); iterateChildren(nodep); @@ -579,7 +579,7 @@ private: fetchConst(nodep->fhsp())->num()); } } - virtual void visit(AstLogAnd* nodep) override { + void visit(AstLogAnd* nodep) override { // Need to short circuit if (!optimizable()) return; // Accelerate checkNodeInfo(nodep); @@ -597,7 +597,7 @@ private: } } } - virtual void visit(AstLogOr* nodep) override { + void visit(AstLogOr* nodep) override { // Need to short circuit if (!optimizable()) return; // Accelerate checkNodeInfo(nodep); @@ -615,7 +615,7 @@ private: } } } - virtual void visit(AstLogIf* nodep) override { + void visit(AstLogIf* nodep) override { // Need to short circuit, same as (!A || B) if (!optimizable()) return; // Accelerate checkNodeInfo(nodep); @@ -635,7 +635,7 @@ private: } } } - virtual void visit(AstNodeCond* nodep) override { + void visit(AstNodeCond* nodep) override { // We could use above visit(AstNodeTriop), but need to do short circuiting. // It's also slower even O(n^2) to evaluate both sides when we // really only need to evaluate one side. @@ -755,7 +755,7 @@ private: } } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { if (jumpingOver(nodep)) return; if (!optimizable()) return; // Accelerate checkNodeInfo(nodep); @@ -795,7 +795,7 @@ private: } m_inDlyAssign = false; } - virtual void visit(AstArraySel* nodep) override { + void visit(AstArraySel* nodep) override { checkNodeInfo(nodep); iterateChildren(nodep); if (AstInitArray* const initp = VN_CAST(fetchValueNull(nodep->fromp()), InitArray)) { @@ -812,11 +812,11 @@ private: clearOptimizable(nodep, "Array select of non-array"); } } - virtual void visit(AstBegin* nodep) override { + void visit(AstBegin* nodep) override { checkNodeInfo(nodep); iterateChildren(nodep); } - virtual void visit(AstNodeCase* nodep) override { + void visit(AstNodeCase* nodep) override { if (jumpingOver(nodep)) return; UINFO(5, " CASE " << nodep << endl); checkNodeInfo(nodep); @@ -854,20 +854,20 @@ private: } } - virtual void visit(AstCaseItem* nodep) override { + void visit(AstCaseItem* nodep) override { // Real handling is in AstNodeCase if (jumpingOver(nodep)) return; checkNodeInfo(nodep); iterateChildren(nodep); } - virtual void visit(AstComment*) override {} + void visit(AstComment*) override {} - virtual void visit(AstJumpBlock* nodep) override { + void visit(AstJumpBlock* nodep) override { if (jumpingOver(nodep)) return; iterateChildren(nodep); } - virtual void visit(AstJumpGo* nodep) override { + void visit(AstJumpGo* nodep) override { if (jumpingOver(nodep)) return; checkNodeInfo(nodep); if (!m_checkOnly) { @@ -875,7 +875,7 @@ private: m_jumpp = nodep; } } - virtual void visit(AstJumpLabel* nodep) override { + void visit(AstJumpLabel* nodep) override { // This only supports forward jumps. That's all we make at present, // AstJumpGo::broken uses brokeExistsBelow() to check this. if (jumpingOver(nodep)) return; @@ -886,7 +886,7 @@ private: m_jumpp = nullptr; } } - virtual void visit(AstStop* nodep) override { + void visit(AstStop* nodep) override { if (jumpingOver(nodep)) return; if (m_params) { // This message seems better than an obscure $stop // The spec says $stop is just ignored, it seems evil to ignore assertions @@ -897,7 +897,7 @@ private: checkNodeInfo(nodep); } - virtual void visit(AstNodeFor* nodep) override { + void visit(AstNodeFor* nodep) override { // Doing lots of Whiles is slow, so only for parameters UINFO(5, " FOR " << nodep << endl); if (!m_params) { @@ -929,7 +929,7 @@ private: } } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { // Doing lots of Whiles is slow, so only for parameters if (jumpingOver(nodep)) return; UINFO(5, " WHILE " << nodep << endl); @@ -969,7 +969,7 @@ private: } } - virtual void visit(AstFuncRef* nodep) override { + void visit(AstFuncRef* nodep) override { if (jumpingOver(nodep)) return; if (!optimizable()) return; // Accelerate UINFO(5, " FUNCREF " << nodep << endl); @@ -1041,7 +1041,7 @@ private: } } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { if (jumpingOver(nodep)) return; if (!m_params) { badNodeType(nodep); @@ -1049,12 +1049,12 @@ private: } } - virtual void visit(AstScopeName* nodep) override { + void visit(AstScopeName* nodep) override { if (jumpingOver(nodep)) return; // Ignore } - virtual void visit(AstSFormatF* nodep) override { + void visit(AstSFormatF* nodep) override { if (jumpingOver(nodep)) return; if (!optimizable()) return; // Accelerate checkNodeInfo(nodep); @@ -1108,7 +1108,7 @@ private: } } - virtual void visit(AstDisplay* nodep) override { + void visit(AstDisplay* nodep) override { if (jumpingOver(nodep)) return; if (!optimizable()) return; // Accelerate // We ignore isPredictOptimizable as $display is often in constant @@ -1133,7 +1133,7 @@ private: // These types are definitely not reducible // AstCoverInc, AstFinish, // AstRand, AstTime, AstUCFunc, AstCCall, AstCStmt, AstUCStmt - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { if (jumpingOver(nodep)) return; badNodeType(nodep); } @@ -1188,7 +1188,7 @@ public: setMode(false /*scoped*/, false /*checking*/, true /*params*/); mainGuts(nodep); } - virtual ~SimulateVisitor() override { + ~SimulateVisitor() override { for (const auto& pair : m_constps) { for (AstConst* const constp : pair.second) { delete constp; } } diff --git a/src/V3Slice.cpp b/src/V3Slice.cpp index b143373f2..c5a993e75 100644 --- a/src/V3Slice.cpp +++ b/src/V3Slice.cpp @@ -128,7 +128,7 @@ class SliceVisitor final : public VNVisitor { return newp; } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { // Called recursively on newly created assignments if (!nodep->user1() && !VN_IS(nodep, AssignAlias)) { nodep->user1(true); @@ -162,7 +162,7 @@ class SliceVisitor final : public VNVisitor { } } - virtual void visit(AstInitArray* nodep) override { + void visit(AstInitArray* nodep) override { UASSERT_OBJ(!m_assignp, nodep, "Array initialization should have been removed earlier"); } @@ -221,17 +221,17 @@ class SliceVisitor final : public VNVisitor { iterateChildren(nodep); } } - virtual void visit(AstEq* nodep) override { expandBiOp(nodep); } - virtual void visit(AstNeq* nodep) override { expandBiOp(nodep); } - virtual void visit(AstEqCase* nodep) override { expandBiOp(nodep); } - virtual void visit(AstNeqCase* nodep) override { expandBiOp(nodep); } + void visit(AstEq* nodep) override { expandBiOp(nodep); } + void visit(AstNeq* nodep) override { expandBiOp(nodep); } + void visit(AstEqCase* nodep) override { expandBiOp(nodep); } + void visit(AstNeqCase* nodep) override { expandBiOp(nodep); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit SliceVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~SliceVisitor() override = default; + ~SliceVisitor() override = default; }; //###################################################################### diff --git a/src/V3Split.cpp b/src/V3Split.cpp index 83dc6ac5b..3e9f4e9ec 100644 --- a/src/V3Split.cpp +++ b/src/V3Split.cpp @@ -103,14 +103,12 @@ protected: SplitNodeVertex(V3Graph* graphp, AstNode* nodep) : V3GraphVertex{graphp} , m_nodep{nodep} {} - virtual ~SplitNodeVertex() override = default; + ~SplitNodeVertex() override = default; // ACCESSORS // Do not make accessor for nodep(), It may change due to // reordering a lower block, but we don't repair it - virtual string name() const override { - return cvtToHex(m_nodep) + ' ' + m_nodep->prettyTypeName(); - } - virtual FileLine* fileline() const override { return nodep()->fileline(); } + string name() const override { return cvtToHex(m_nodep) + ' ' + m_nodep->prettyTypeName(); } + FileLine* fileline() const override { return nodep()->fileline(); } public: virtual AstNode* nodep() const { return m_nodep; } @@ -120,34 +118,34 @@ class SplitPliVertex final : public SplitNodeVertex { public: explicit SplitPliVertex(V3Graph* graphp, AstNode* nodep) : SplitNodeVertex{graphp, nodep} {} - virtual ~SplitPliVertex() override = default; - virtual string name() const override { return "*PLI*"; } - virtual string dotColor() const override { return "green"; } + ~SplitPliVertex() override = default; + string name() const override { return "*PLI*"; } + string dotColor() const override { return "green"; } }; class SplitLogicVertex final : public SplitNodeVertex { public: SplitLogicVertex(V3Graph* graphp, AstNode* nodep) : SplitNodeVertex{graphp, nodep} {} - virtual ~SplitLogicVertex() override = default; - virtual string dotColor() const override { return "yellow"; } + ~SplitLogicVertex() override = default; + string dotColor() const override { return "yellow"; } }; class SplitVarStdVertex final : public SplitNodeVertex { public: SplitVarStdVertex(V3Graph* graphp, AstNode* nodep) : SplitNodeVertex{graphp, nodep} {} - virtual ~SplitVarStdVertex() override = default; - virtual string dotColor() const override { return "skyblue"; } + ~SplitVarStdVertex() override = default; + string dotColor() const override { return "skyblue"; } }; class SplitVarPostVertex final : public SplitNodeVertex { public: SplitVarPostVertex(V3Graph* graphp, AstNode* nodep) : SplitNodeVertex{graphp, nodep} {} - virtual ~SplitVarPostVertex() override = default; - virtual string name() const override { return string("POST ") + SplitNodeVertex::name(); } - virtual string dotColor() const override { return "CadetBlue"; } + ~SplitVarPostVertex() override = default; + string name() const override { return string("POST ") + SplitNodeVertex::name(); } + string dotColor() const override { return "CadetBlue"; } }; //###################################################################### @@ -161,7 +159,7 @@ protected: SplitEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top, int weight, bool cutable = CUTABLE) : V3GraphEdge{graphp, fromp, top, weight, cutable} {} - virtual ~SplitEdge() override = default; + ~SplitEdge() override = default; public: // Iterator for graph functions @@ -180,7 +178,7 @@ public: if (!oedgep) v3fatalSrc("Following edge of non-SplitEdge type"); return (!oedgep->ignoreThisStep()); } - virtual string dotStyle() const override { + string dotStyle() const override { return ignoreThisStep() ? "dotted" : V3GraphEdge::dotStyle(); } }; @@ -190,36 +188,36 @@ class SplitPostEdge final : public SplitEdge { public: SplitPostEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) : SplitEdge{graphp, fromp, top, WEIGHT_NORMAL} {} - virtual ~SplitPostEdge() override = default; - virtual bool followScoreboard() const override { return false; } - virtual string dotColor() const override { return "khaki"; } + ~SplitPostEdge() override = default; + bool followScoreboard() const override { return false; } + string dotColor() const override { return "khaki"; } }; class SplitLVEdge final : public SplitEdge { public: SplitLVEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) : SplitEdge{graphp, fromp, top, WEIGHT_NORMAL} {} - virtual ~SplitLVEdge() override = default; - virtual bool followScoreboard() const override { return true; } - virtual string dotColor() const override { return "yellowGreen"; } + ~SplitLVEdge() override = default; + bool followScoreboard() const override { return true; } + string dotColor() const override { return "yellowGreen"; } }; class SplitRVEdge final : public SplitEdge { public: SplitRVEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) : SplitEdge{graphp, fromp, top, WEIGHT_NORMAL} {} - virtual ~SplitRVEdge() override = default; - virtual bool followScoreboard() const override { return true; } - virtual string dotColor() const override { return "green"; } + ~SplitRVEdge() override = default; + bool followScoreboard() const override { return true; } + string dotColor() const override { return "green"; } }; struct SplitScorebdEdge : public SplitEdge { public: SplitScorebdEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) : SplitEdge{graphp, fromp, top, WEIGHT_NORMAL} {} - virtual ~SplitScorebdEdge() override = default; - virtual bool followScoreboard() const override { return true; } - virtual string dotColor() const override { return "blue"; } + ~SplitScorebdEdge() override = default; + bool followScoreboard() const override { return true; } + string dotColor() const override { return "blue"; } }; struct SplitStrictEdge : public SplitEdge { @@ -228,9 +226,9 @@ struct SplitStrictEdge : public SplitEdge { public: SplitStrictEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) : SplitEdge{graphp, fromp, top, WEIGHT_NORMAL, NOT_CUTABLE} {} - virtual ~SplitStrictEdge() override = default; - virtual bool followScoreboard() const override { return true; } - virtual string dotColor() const override { return "blue"; } + ~SplitStrictEdge() override = default; + bool followScoreboard() const override { return true; } + string dotColor() const override { return "blue"; } }; //###################################################################### @@ -259,7 +257,7 @@ protected: // CONSTRUCTORS public: SplitReorderBaseVisitor() { scoreboardClear(); } - virtual ~SplitReorderBaseVisitor() override = default; + ~SplitReorderBaseVisitor() override = default; // METHODS protected: @@ -335,19 +333,19 @@ protected: virtual void makeRvalueEdges(SplitVarStdVertex* vstdp) = 0; // VISITORS - virtual void visit(AstAlways* nodep) override = 0; - virtual void visit(AstNodeIf* nodep) override = 0; + void visit(AstAlways* nodep) override = 0; + void visit(AstNodeIf* nodep) override = 0; // We don't do AstNodeFor/AstWhile loops, due to the standard question // of what is before vs. after - virtual void visit(AstAssignDly* nodep) override { + void visit(AstAssignDly* nodep) override { m_inDly = true; UINFO(4, " ASSIGNDLY " << nodep << endl); iterateChildren(nodep); m_inDly = false; } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (!m_stmtStackps.empty()) { AstVarScope* const vscp = nodep->varScopep(); UASSERT_OBJ(vscp, nodep, "Not linked"); @@ -410,7 +408,7 @@ protected: } } - virtual void visit(AstJumpGo* nodep) override { + void visit(AstJumpGo* nodep) override { // Jumps will disable reordering at all levels // This is overly pessimistic; we could treat jumps as barriers, and // reorder everything between jumps/labels, however jumps are rare @@ -422,7 +420,7 @@ protected: //-------------------- // Default - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { // **** SPECIAL default type that sets PLI_ORDERING if (!m_stmtStackps.empty() && !nodep->isPure()) { UINFO(9, " NotSplittable " << nodep << endl); @@ -439,11 +437,11 @@ class ReorderVisitor final : public SplitReorderBaseVisitor { // CONSTRUCTORS public: explicit ReorderVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~ReorderVisitor() override = default; + ~ReorderVisitor() override = default; // METHODS protected: - virtual void makeRvalueEdges(SplitVarStdVertex* vstdp) override { + void makeRvalueEdges(SplitVarStdVertex* vstdp) override { for (SplitLogicVertex* vxp : m_stmtStackps) new SplitRVEdge(&m_graph, vxp, vstdp); } @@ -599,7 +597,7 @@ protected: firstp->user3p(oldBlockUser3); } - virtual void visit(AstAlways* nodep) override { + void visit(AstAlways* nodep) override { UINFO(4, " ALW " << nodep << endl); if (debug() >= 9) nodep->dumpTree(cout, " alwIn:: "); scoreboardClear(); @@ -607,7 +605,7 @@ protected: if (debug() >= 9) nodep->dumpTree(cout, " alwOut: "); } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { UINFO(4, " IF " << nodep << endl); iterateAndNextNull(nodep->condp()); processBlock(nodep->ifsp()); @@ -636,7 +634,7 @@ public: // Visit through *nodep and map each AstNodeIf within to the set of // colors it will participate in. Also find the whole set of colors. explicit IfColorVisitor(AstAlways* nodep) { iterate(nodep); } - virtual ~IfColorVisitor() override = default; + ~IfColorVisitor() override = default; // METHODS const ColorSet& colors() const { return m_colors; } @@ -663,13 +661,13 @@ private: } protected: - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { m_ifStack.push_back(nodep); trackNode(nodep); iterateChildren(nodep); m_ifStack.pop_back(); } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { trackNode(nodep); iterateChildren(nodep); } @@ -701,7 +699,7 @@ public: UINFO(6, " splitting always " << nodep << endl); } - virtual ~EmitSplitVisitor() override = default; + ~EmitSplitVisitor() override = default; // METHODS void go() { @@ -732,7 +730,7 @@ protected: return new AstSplitPlaceholder(m_origAlwaysp->fileline()); } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { // Anything that's not an if/else we assume is a leaf // (that is, something we won't split.) Don't visit further // into the leaf. @@ -754,7 +752,7 @@ protected: m_addAfter[color] = clonedp; } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { const ColorSet& colors = m_ifColorp->colors(nodep); using CloneMap = std::unordered_map; CloneMap clones; @@ -798,17 +796,17 @@ class RemovePlaceholdersVisitor final : public VNVisitor { // CONSTRUCTORS RemovePlaceholdersVisitor() = default; - virtual ~RemovePlaceholdersVisitor() override = default; + ~RemovePlaceholdersVisitor() override = default; // VISITORS - virtual void visit(AstSplitPlaceholder* nodep) override { pushDeletep(nodep->unlinkFrBack()); } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstSplitPlaceholder* nodep) override { pushDeletep(nodep->unlinkFrBack()); } + void visit(AstNodeIf* nodep) override { VL_RESTORER(m_isPure); m_isPure = true; iterateChildren(nodep); if (!nodep->ifsp() && !nodep->elsesp() && m_isPure) pushDeletep(nodep->unlinkFrBack()); } - virtual void visit(AstAlways* nodep) override { + void visit(AstAlways* nodep) override { VL_RESTORER(m_isPure); m_isPure = true; iterateChildren(nodep); @@ -828,7 +826,7 @@ class RemovePlaceholdersVisitor final : public VNVisitor { } } } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { m_isPure &= nodep->isPure(); iterateChildren(nodep); // must visit regardless of m_isPure to remove placeholders } @@ -875,13 +873,11 @@ public: } } - virtual ~SplitVisitor() override { - V3Stats::addStat("Optimizations, Split always", m_statSplits); - } + ~SplitVisitor() override { V3Stats::addStat("Optimizations, Split always", m_statSplits); } // METHODS protected: - virtual void makeRvalueEdges(SplitVarStdVertex* vstdp) override { + void makeRvalueEdges(SplitVarStdVertex* vstdp) override { // Each 'if' depends on rvalues in its own conditional ONLY, // not rvalues in the if/else bodies. for (auto it = m_stmtStackps.cbegin(); it != m_stmtStackps.cend(); ++it) { @@ -956,7 +952,7 @@ protected: if (debug() >= 9) m_graph.dumpDotFilePrefixed("splitg_colored", false); } - virtual void visit(AstAlways* nodep) override { + void visit(AstAlways* nodep) override { // build the scoreboard scoreboardClear(); scanBlock(nodep->bodysp()); @@ -988,7 +984,7 @@ protected: emitSplit.go(); } } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { UINFO(4, " IF " << nodep << endl); m_curIfConditional = nodep; iterateAndNextNull(nodep->condp()); diff --git a/src/V3SplitAs.cpp b/src/V3SplitAs.cpp index ebdac1d7a..d22429f93 100644 --- a/src/V3SplitAs.cpp +++ b/src/V3SplitAs.cpp @@ -49,17 +49,17 @@ private: AstVarScope* m_splitVscp = nullptr; // Variable we want to split // METHODS - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (nodep->access().isWriteOrRW() && !m_splitVscp && nodep->varp()->attrIsolateAssign()) { m_splitVscp = nodep->varScopep(); } } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit SplitAsFindVisitor(AstAlways* nodep) { iterate(nodep); } - virtual ~SplitAsFindVisitor() override = default; + ~SplitAsFindVisitor() override = default; // METHODS AstVarScope* splitVscp() const { return m_splitVscp; } }; @@ -76,7 +76,7 @@ private: bool m_matches = false; // Statement below has matching lvalue reference // METHODS - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (nodep->access().isWriteOrRW()) { if (nodep->varScopep() == m_splitVscp) { UINFO(6, " CL VAR " << nodep << endl); @@ -84,7 +84,7 @@ private: } } } - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { if (!nodep->isStatement()) { iterateChildren(nodep); return; @@ -110,7 +110,7 @@ private: m_keepStmt = oldKeep || m_keepStmt; UINFO(9, " upKeep=" << m_keepStmt << " STMT " << nodep << endl); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -119,7 +119,7 @@ public: , m_modeMatch{modeMatch} { iterate(nodep); } - virtual ~SplitAsCleanVisitor() override = default; + ~SplitAsCleanVisitor() override = default; }; //###################################################################### @@ -154,7 +154,7 @@ private: } } - virtual void visit(AstAlways* nodep) override { + void visit(AstAlways* nodep) override { // Are there any lvalue references below this? // There could be more than one. So, we process the first one found first. const AstVarScope* lastSplitVscp = nullptr; @@ -179,13 +179,13 @@ private: } // Speedup; no always under math - virtual void visit(AstNodeMath*) override {} - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeMath*) override {} + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit SplitAsVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~SplitAsVisitor() override { + ~SplitAsVisitor() override { V3Stats::addStat("Optimizations, isolate_assignments blocks", m_statSplits); } }; diff --git a/src/V3SplitVar.cpp b/src/V3SplitVar.cpp index 7ca9464d0..47dc0e006 100644 --- a/src/V3SplitVar.cpp +++ b/src/V3SplitVar.cpp @@ -362,10 +362,10 @@ public: void remove(AstNode* nodep) { struct Visitor : public VNVisitor { RefsInModule& m_parent; - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } - virtual void visit(AstVar* nodep) override { m_parent.m_vars.erase(nodep); } - virtual void visit(AstVarRef* nodep) override { m_parent.m_refs.erase(nodep); } - virtual void visit(AstSel* nodep) override { + void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstVar* nodep) override { m_parent.m_vars.erase(nodep); } + void visit(AstVarRef* nodep) override { m_parent.m_refs.erase(nodep); } + void visit(AstSel* nodep) override { m_parent.m_sels.erase(nodep); iterateChildren(nodep); } @@ -456,8 +456,8 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl { return refp; } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeModule* nodep) override { UINFO(4, "Start checking " << nodep->prettyNameQ() << "\n"); if (!VN_IS(nodep, Module)) { UINFO(4, "Skip " << nodep->prettyNameQ() << "\n"); @@ -471,9 +471,9 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl { split(); m_modp = nullptr; } - virtual void visit(AstNodeStmt* nodep) override { setContextAndIterateChildren(nodep); } - virtual void visit(AstCell* nodep) override { setContextAndIterateChildren(nodep); } - virtual void visit(AstAlways* nodep) override { + void visit(AstNodeStmt* nodep) override { setContextAndIterateChildren(nodep); } + void visit(AstCell* nodep) override { setContextAndIterateChildren(nodep); } + void visit(AstAlways* nodep) override { if (nodep->sensesp()) { // When visiting sensitivity list, always is the context setContextAndIterate(nodep, nodep->sensesp()); } @@ -481,7 +481,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl { iterate(bodysp); } }; - virtual void visit(AstAlwaysPublic* nodep) override { + void visit(AstAlwaysPublic* nodep) override { if (nodep->sensesp()) { // When visiting sensitivity list, always is the context setContextAndIterate(nodep, nodep->sensesp()); } @@ -489,7 +489,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl { iterate(bodysp); } } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { VL_RESTORER(m_contextp); { m_contextp = nodep; @@ -524,7 +524,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl { } } } - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { UINFO(5, nodep->modVarp()->prettyNameQ() << " pin \n"); AstNode* const exprp = nodep->exprp(); if (!exprp) return; // Not connected pin @@ -538,7 +538,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl { m_foundTargetVar.clear(); } } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { UASSERT_OBJ(!m_inFTask, nodep, "Nested func/task"); if (!cannotSplitTaskReason(nodep)) { m_inFTask = nodep; @@ -546,7 +546,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl { m_inFTask = nullptr; } } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { if (!nodep->attrSplitVar()) return; // Nothing to do if (!cannotSplitReason(nodep)) { m_refs.registerVar(nodep); @@ -554,18 +554,18 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl { } m_refsForPackedSplit[m_modp].add(nodep); } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (!nodep->varp()->attrSplitVar()) return; // Nothing to do if (m_refs.tryAdd(m_contextp, nodep, m_inFTask)) { m_foundTargetVar.insert(nodep->varp()); } m_refsForPackedSplit[m_modp].add(nodep); } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { if (VN_IS(nodep->fromp(), VarRef)) m_refsForPackedSplit[m_modp].add(nodep); iterateChildren(nodep); } - virtual void visit(AstArraySel* nodep) override { + void visit(AstArraySel* nodep) override { if (AstVarRef* const refp = isTargetVref(nodep->fromp())) { const AstConst* const indexp = VN_CAST(nodep->bitp(), Const); if (indexp) { // OK @@ -585,7 +585,7 @@ class SplitUnpackedVarVisitor final : public VNVisitor, public SplitVarImpl { iterateChildren(nodep); } } - virtual void visit(AstSliceSel* nodep) override { + void visit(AstSliceSel* nodep) override { if (AstVarRef* const refp = isTargetVref(nodep->fromp())) { const AstUnpackArrayDType* const dtypep = VN_AS(refp->varp()->dtypep()->skipRefp(), UnpackArrayDType); @@ -966,10 +966,10 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl { int m_numSplit = 0; // Total number of split variables // key:variable to be split. value:location where the variable is referenced. std::map m_refs; - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { if (!cannotSplitTaskReason(nodep)) iterateChildren(nodep); } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { if (!nodep->attrSplitVar()) return; // Nothing to do if (const char* const reason = cannotSplitReason(nodep, true)) { warnNoSplit(nodep, nodep, reason); @@ -979,7 +979,7 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl { if (inserted) UINFO(3, nodep->prettyNameQ() << " is added to candidate list.\n"); } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { AstVar* const varp = nodep->varp(); visit(varp); const auto refit = m_refs.find(varp); @@ -993,7 +993,7 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl { UINFO(5, varp->prettyName() << " Entire bit of [" << basicp->lo() << "+:" << varp->width() << "] \n"); } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { const AstVarRef* const vrefp = VN_CAST(nodep->fromp(), VarRef); if (!vrefp) { iterateChildren(nodep); @@ -1032,7 +1032,7 @@ class SplitPackedVarVisitor final : public VNVisitor, public SplitVarImpl { iterateChildren(nodep); } } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } // Extract necessary bit range from a newly created variable to meet ref static AstNode* extractBits(const PackedVarRefEntry& ref, const SplitNewVar& var, diff --git a/src/V3Stats.cpp b/src/V3Stats.cpp index 11512254d..01d3ec2f2 100644 --- a/src/V3Stats.cpp +++ b/src/V3Stats.cpp @@ -76,7 +76,7 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { allNodes(nodep); if (!m_fast) { // Count all CFuncs below this module @@ -85,7 +85,7 @@ private: // Else we recursively trace fast CFuncs from the top _eval // func, see visit(AstNetlist*) } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { allNodes(nodep); iterateChildrenConst(nodep); if (m_counting && nodep->dtypep()) { @@ -111,7 +111,7 @@ private: } } } - virtual void visit(AstVarScope* nodep) override { + void visit(AstVarScope* nodep) override { allNodes(nodep); iterateChildrenConst(nodep); if (m_counting) { @@ -120,7 +120,7 @@ private: } } } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { UINFO(4, " IF i=" << m_instrs << " " << nodep << endl); allNodes(nodep); // Condition is part of cost allocated to PREVIOUS block @@ -166,9 +166,9 @@ private: } } // While's we assume evaluate once. - // virtual void visit(AstWhile* nodep) override { + // void visit(AstWhile* nodep) override { - virtual void visit(AstNodeCCall* nodep) override { + void visit(AstNodeCCall* nodep) override { allNodes(nodep); iterateChildrenConst(nodep); if (m_fast && !nodep->funcp()->entryPoint()) { @@ -177,7 +177,7 @@ private: iterate(nodep->funcp()); } } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { if (m_fast) { if (!m_tracingCall && !nodep->entryPoint()) return; m_tracingCall = false; @@ -189,11 +189,11 @@ private: iterateChildrenConst(nodep); } } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { allNodes(nodep); iterateChildrenConst(nodep); } - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { if (m_fast && nodep->evalp()) { m_instrs = 0; m_counting = true; @@ -219,7 +219,7 @@ public: // Process iterate(nodep); } - virtual ~StatsVisitor() override { + ~StatsVisitor() override { // Done. Publish statistics V3Stats::addStat(m_stage, "Instruction count, TOTAL", m_statInstr); V3Stats::addStat(m_stage, "Instruction count, fast critical", m_statInstrFast); diff --git a/src/V3Subst.cpp b/src/V3Subst.cpp index ce43a7fd0..eda173f78 100644 --- a/src/V3Subst.cpp +++ b/src/V3Subst.cpp @@ -189,7 +189,7 @@ private: return reinterpret_cast(nodep->varp()->user1p()); // Might be nullptr } // VISITORS - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { const SubstVarEntry* const entryp = findEntryp(nodep); if (entryp) { // Don't sweat it. We assign a new temp variable for every new assignment, @@ -204,8 +204,8 @@ private: } } } - virtual void visit(AstConst*) override {} // Accelerate - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstConst*) override {} // Accelerate + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -214,7 +214,7 @@ public: UINFO(9, " SubstUseVisitor " << origStep << " " << nodep << endl); iterate(nodep); } - virtual ~SubstUseVisitor() override = default; + ~SubstUseVisitor() override = default; // METHODS bool ok() const { return m_ok; } }; @@ -258,7 +258,7 @@ private: inline bool isSubstVar(AstVar* nodep) { return nodep->isStatementTemp() && !nodep->noSubst(); } // VISITORS - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { m_ops = 0; m_assignStep++; iterateAndNextNull(nodep->rhsp()); @@ -304,7 +304,7 @@ private: VL_DO_DANGLING(pushDeletep(nodep), nodep); ++m_statSubsts; } - virtual void visit(AstWordSel* nodep) override { + void visit(AstWordSel* nodep) override { iterate(nodep->rhsp()); AstVarRef* const varrefp = VN_CAST(nodep->lhsp(), VarRef); const AstConst* const constp = VN_CAST(nodep->rhsp(), Const); @@ -329,7 +329,7 @@ private: iterate(nodep->lhsp()); } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { // Any variable if (nodep->access().isWriteOrRW()) { m_assignStep++; @@ -357,16 +357,16 @@ private: } } } - virtual void visit(AstVar*) override {} - virtual void visit(AstConst*) override {} - virtual void visit(AstModule* nodep) override { + void visit(AstVar*) override {} + void visit(AstConst*) override {} + void visit(AstModule* nodep) override { ++m_ops; if (!nodep->isSubstOptimizable()) m_ops = SUBST_MAX_OPS_NA; iterateChildren(nodep); // Reduce peak memory usage by reclaiming the edited AstNodes doDeletes(); } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { m_ops++; if (!nodep->isSubstOptimizable()) m_ops = SUBST_MAX_OPS_NA; iterateChildren(nodep); @@ -375,7 +375,7 @@ private: public: // CONSTRUCTORS explicit SubstVisitor(AstNode* nodep) { iterate(nodep); } - virtual ~SubstVisitor() override { + ~SubstVisitor() override { V3Stats::addStat("Optimizations, Substituted temps", m_statSubsts); for (SubstVarEntry* ip : m_entryps) { ip->deleteUnusedAssign(); diff --git a/src/V3TSP.cpp b/src/V3TSP.cpp index 27d877369..c89e1f3b9 100644 --- a/src/V3TSP.cpp +++ b/src/V3TSP.cpp @@ -61,7 +61,7 @@ public: TspVertexTmpl(V3Graph* graphp, const T_Key& k) : V3GraphVertex{graphp} , m_key{k} {} - virtual ~TspVertexTmpl() override = default; + ~TspVertexTmpl() override = default; const T_Key& key() const { return m_key; } private: @@ -84,7 +84,7 @@ public: // CONSTRUCTORS TspGraphTmpl() : V3Graph{} {} - virtual ~TspGraphTmpl() override = default; + ~TspGraphTmpl() override = default; // METHODS void addVertex(const T_Key& key) { @@ -542,8 +542,8 @@ public: : m_xpos{xpos} , m_ypos{ypos} , m_serial{++s_serialNext} {} - virtual ~TspTestState() override = default; - virtual int cost(const TspStateBase* otherp) const override { + ~TspTestState() override = default; + int cost(const TspStateBase* otherp) const override { return cost(dynamic_cast(otherp)); } static unsigned diff(unsigned a, unsigned b) { diff --git a/src/V3Table.cpp b/src/V3Table.cpp index 8829e9cbf..76fcb3711 100644 --- a/src/V3Table.cpp +++ b/src/V3Table.cpp @@ -59,12 +59,12 @@ class TableSimulateVisitor final : public SimulateVisitor { public: ///< Call other-this function on all new var references - virtual void varRefCb(AstVarRef* nodep) override; + void varRefCb(AstVarRef* nodep) override; // CONSTRUCTORS explicit TableSimulateVisitor(TableVisitor* cbthis) : m_cbthis{cbthis} {} - virtual ~TableSimulateVisitor() override = default; + ~TableSimulateVisitor() override = default; }; //###################################################################### @@ -379,8 +379,8 @@ private: } // VISITORS - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); VL_RESTORER(m_modTables); { @@ -389,20 +389,20 @@ private: iterateChildren(nodep); } } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { UINFO(4, " SCOPE " << nodep << endl); m_scopep = nodep; iterateChildren(nodep); m_scopep = nullptr; } - virtual void visit(AstAlways* nodep) override { + void visit(AstAlways* nodep) override { UINFO(4, " ALWAYS " << nodep << endl); if (treeTest(nodep)) { // Well, then, I'll be a memory hog. replaceWithTable(nodep); } } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { // It's nearly impossible to have a large enough assign to make this worthwhile // For now we won't bother. // Accelerated: no iterate @@ -411,7 +411,7 @@ private: public: // CONSTRUCTORS explicit TableVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~TableVisitor() override { // + ~TableVisitor() override { // V3Stats::addStat("Optimizations, Tables created", m_statTablesCre); } }; diff --git a/src/V3Task.cpp b/src/V3Task.cpp index c736bb86b..c298f8ed4 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -47,7 +47,7 @@ class TaskBaseVertex VL_NOT_FINAL : public V3GraphVertex { public: explicit TaskBaseVertex(V3Graph* graphp) : V3GraphVertex{graphp} {} - virtual ~TaskBaseVertex() override = default; + ~TaskBaseVertex() override = default; bool pure() const { return m_impurep == nullptr; } AstNode* impureNode() const { return m_impurep; } void impure(AstNode* nodep) { m_impurep = nodep; } @@ -64,10 +64,10 @@ public: TaskFTaskVertex(V3Graph* graphp, AstNodeFTask* nodep) : TaskBaseVertex{graphp} , m_nodep{nodep} {} - virtual ~TaskFTaskVertex() override = default; + ~TaskFTaskVertex() override = default; AstNodeFTask* nodep() const { return m_nodep; } - virtual string name() const override { return nodep()->name(); } - virtual string dotColor() const override { return pure() ? "black" : "red"; } + string name() const override { return nodep()->name(); } + string dotColor() const override { return pure() ? "black" : "red"; } AstCFunc* cFuncp() const { return m_cFuncp; } void cFuncp(AstCFunc* nodep) { m_cFuncp = nodep; } }; @@ -77,17 +77,17 @@ class TaskCodeVertex final : public TaskBaseVertex { public: explicit TaskCodeVertex(V3Graph* graphp) : TaskBaseVertex{graphp} {} - virtual ~TaskCodeVertex() override = default; - virtual string name() const override { return "*CODE*"; } - virtual string dotColor() const override { return "green"; } + ~TaskCodeVertex() override = default; + string name() const override { return "*CODE*"; } + string dotColor() const override { return "green"; } }; class TaskEdge final : public V3GraphEdge { public: TaskEdge(V3Graph* graphp, TaskBaseVertex* fromp, TaskBaseVertex* top) : V3GraphEdge{graphp, fromp, top, 1, false} {} - virtual ~TaskEdge() override = default; - virtual string dotLabel() const override { return "w" + cvtToStr(weight()); } + ~TaskEdge() override = default; + string dotLabel() const override { return "w" + cvtToStr(weight()); } }; //###################################################################### @@ -166,7 +166,7 @@ private: } // VISITORS - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { // Each FTask is unique per-scope, so AstNodeFTaskRefs do not need // pointers to what scope the FTask is to be invoked under. // However, to create variables, we need to track the scopes involved. @@ -186,12 +186,12 @@ private: } iterateChildren(nodep); } - virtual void visit(AstAssignW* nodep) override { + void visit(AstAssignW* nodep) override { m_assignwp = nodep; VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep. m_assignwp = nullptr; } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { // Includes handling AstMethodCall, AstNew if (m_assignwp) { // Wire assigns must become always statements to deal with insertion @@ -204,7 +204,7 @@ private: UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked task"); new TaskEdge(&m_callGraph, m_curVxp, getFTaskVertex(nodep->taskp())); } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { UINFO(9, " TASK " << nodep << endl); { VL_RESTORER(m_curVxp); @@ -221,7 +221,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstPragma* nodep) override { + void visit(AstPragma* nodep) override { if (nodep->pragType() == VPragmaType::NO_INLINE_TASK) { // Just mark for the next steps, and we're done with it. m_curVxp->noInline(true); @@ -230,17 +230,17 @@ private: iterateChildren(nodep); } } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { iterateChildren(nodep); nodep->user4p(m_curVxp); // Remember what task it's under } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { iterateChildren(nodep); if (nodep->varp()->user4u().toGraphVertex() != m_curVxp) { if (m_curVxp->pure() && !nodep->varp()->isXTemp()) m_curVxp->impure(nodep); } } - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { // Move initial statements into the constructor m_initialps.clear(); m_ctorp = nullptr; @@ -264,12 +264,12 @@ private: m_ctorp = nullptr; m_classp = nullptr; } - virtual void visit(AstInitialAutomatic* nodep) override { + void visit(AstInitialAutomatic* nodep) override { m_initialps.push_back(nodep); iterateChildren(nodep); } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -283,7 +283,7 @@ public: m_callGraph.removeRedundantEdgesSum(&TaskEdge::followAlwaysTrue); m_callGraph.dumpDotFilePrefixed("task_call"); } - virtual ~TaskStateVisitor() override = default; + ~TaskStateVisitor() override = default; VL_UNCOPYABLE(TaskStateVisitor); }; @@ -1366,7 +1366,7 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); VL_RESTORER(m_modNCalls); { @@ -1376,13 +1376,13 @@ private: iterateChildren(nodep); } } - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { m_scopep = nodep; m_insStmtp = nullptr; iterateChildren(nodep); m_scopep = nullptr; } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { // Includes handling AstMethodCall, AstNew UASSERT_OBJ(nodep->taskp(), nodep, "Unlinked?"); iterateIntoFTask(nodep->taskp()); // First, do hierarchical funcs @@ -1436,7 +1436,7 @@ private: // Visit nodes that normal iteration won't find if (visitp) iterateAndNextNull(visitp); } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { UINFO(4, " visitFTask " << nodep << endl); VL_RESTORER(m_insMode); VL_RESTORER(m_insStmtp); @@ -1504,7 +1504,7 @@ private: VL_DO_DANGLING(pushDeletep(nodep), nodep); } } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { // Special, as statements need to be put in different places // Preconditions insert first just before themselves (the normal // rule for other statement types) @@ -1521,11 +1521,11 @@ private: // Done the loop m_insStmtp = nullptr; // Next thing should be new statement } - virtual void visit(AstNodeFor* nodep) override { // LCOV_EXCL_LINE + void visit(AstNodeFor* nodep) override { // LCOV_EXCL_LINE nodep->v3fatalSrc( "For statements should have been converted to while statements in V3Begin.cpp"); } - virtual void visit(AstNodeStmt* nodep) override { + void visit(AstNodeStmt* nodep) override { if (!nodep->isStatement()) { iterateChildren(nodep); return; @@ -1536,7 +1536,7 @@ private: m_insStmtp = nullptr; // Next thing should be new statement } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -1544,7 +1544,7 @@ public: : m_statep{statep} { iterate(nodep); } - virtual ~TaskVisitor() override = default; + ~TaskVisitor() override = default; }; //###################################################################### diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index 9a1fe1e3c..c98a120a3 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -73,20 +73,20 @@ public: m_activityCode = code; m_slow = false; } - virtual ~TraceActivityVertex() override = default; + ~TraceActivityVertex() override = default; // ACCESSORS AstNode* insertp() const { if (!m_insertp) v3fatalSrc("Null insertp; probably called on a special always/slow."); return m_insertp; } - virtual string name() const override { + string name() const override { if (activityAlways()) { return "*ALWAYS*"; } else { return std::string{slow() ? "*SLOW* " : ""} + insertp()->name(); } } - virtual string dotColor() const override { return slow() ? "yellowGreen" : "green"; } + string dotColor() const override { return slow() ? "yellowGreen" : "green"; } int32_t activityCode() const { return m_activityCode; } bool activityAlways() const { return activityCode() == ACTIVITY_ALWAYS; } bool activitySlow() const { return activityCode() == ACTIVITY_SLOW; } @@ -104,12 +104,12 @@ public: TraceCFuncVertex(V3Graph* graphp, AstCFunc* nodep) : V3GraphVertex{graphp} , m_nodep{nodep} {} - virtual ~TraceCFuncVertex() override = default; + ~TraceCFuncVertex() override = default; // ACCESSORS AstCFunc* nodep() const { return m_nodep; } - virtual string name() const override { return nodep()->name(); } - virtual string dotColor() const override { return "yellow"; } - virtual FileLine* fileline() const override { return nodep()->fileline(); } + string name() const override { return nodep()->name(); } + string dotColor() const override { return "yellow"; } + FileLine* fileline() const override { return nodep()->fileline(); } }; class TraceTraceVertex final : public V3GraphVertex { @@ -121,12 +121,12 @@ public: TraceTraceVertex(V3Graph* graphp, AstTraceDecl* nodep) : V3GraphVertex{graphp} , m_nodep{nodep} {} - virtual ~TraceTraceVertex() override = default; + ~TraceTraceVertex() override = default; // ACCESSORS AstTraceDecl* nodep() const { return m_nodep; } - virtual string name() const override { return nodep()->name(); } - virtual string dotColor() const override { return "red"; } - virtual FileLine* fileline() const override { return nodep()->fileline(); } + string name() const override { return nodep()->name(); } + string dotColor() const override { return "red"; } + FileLine* fileline() const override { return nodep()->fileline(); } TraceTraceVertex* duplicatep() const { return m_duplicatep; } void duplicatep(TraceTraceVertex* dupp) { UASSERT_OBJ(!duplicatep(), nodep(), "Assigning duplicatep() to already duplicated node"); @@ -141,12 +141,12 @@ public: TraceVarVertex(V3Graph* graphp, AstVarScope* nodep) : V3GraphVertex{graphp} , m_nodep{nodep} {} - virtual ~TraceVarVertex() override = default; + ~TraceVarVertex() override = default; // ACCESSORS AstVarScope* nodep() const { return m_nodep; } - virtual string name() const override { return nodep()->name(); } - virtual string dotColor() const override { return "skyblue"; } - virtual FileLine* fileline() const override { return nodep()->fileline(); } + string name() const override { return nodep()->name(); } + string dotColor() const override { return "skyblue"; } + FileLine* fileline() const override { return nodep()->fileline(); } }; //###################################################################### @@ -796,7 +796,7 @@ private: } // VISITORS - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { m_code = 1; // Multiple TopScopes will require fixing how code#s // are assigned as duplicate varscopes must result in the same tracing code#. @@ -811,11 +811,11 @@ private: // Create the trace functions and insert them into the tree createTraceFunctions(); } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { if (nodep->isTop()) m_topModp = nodep; iterateChildren(nodep); } - virtual void visit(AstCCall* nodep) override { + void visit(AstCCall* nodep) override { UINFO(8, " CCALL " << nodep << endl); if (!m_finding && !nodep->user2()) { // See if there are other calls in same statement list; @@ -834,7 +834,7 @@ private: } iterateChildren(nodep); } - virtual void visit(AstCFunc* nodep) override { + void visit(AstCFunc* nodep) override { UINFO(8, " CFUNC " << nodep << endl); V3GraphVertex* const funcVtxp = getCFuncVertexp(nodep); if (!m_finding) { // If public, we need a unique activity code to allow for sets @@ -851,7 +851,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstTraceDecl* nodep) override { + void visit(AstTraceDecl* nodep) override { UINFO(8, " TRACE " << nodep << endl); if (!m_finding) { V3GraphVertex* const vertexp = new TraceTraceVertex(&m_graph, nodep); @@ -863,7 +863,7 @@ private: m_tracep = nullptr; } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (m_tracep) { UASSERT_OBJ(nodep->varScopep(), nodep, "No var scope?"); UASSERT_OBJ(nodep->access().isReadOnly(), nodep, "Lvalue in trace? Should be const."); @@ -888,7 +888,7 @@ private: } } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -896,7 +896,7 @@ public: : m_alwaysVtxp{new TraceActivityVertex{&m_graph, TraceActivityVertex::ACTIVITY_ALWAYS}} { iterate(nodep); } - virtual ~TraceVisitor() override { + ~TraceVisitor() override { V3Stats::addStat("Tracing, Unique traced signals", m_statUniqSigs); V3Stats::addStat("Tracing, Unique trace codes", m_statUniqCodes); } diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index 8268ec487..4c8cae3a8 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -241,7 +241,7 @@ private: } // VISITORS - virtual void visit(AstScope* nodep) override { + void visit(AstScope* nodep) override { UASSERT_OBJ(!m_currScopep, nodep, "Should not nest"); UASSERT_OBJ(m_subFuncps.empty(), nodep, "Should not nest"); UASSERT_OBJ(m_signals.empty(), nodep, "Should not nest"); @@ -330,7 +330,7 @@ private: m_scopeSubFuncps.emplace(scopeName, std::move(m_subFuncps)); } } - virtual void visit(AstVarScope* nodep) override { + void visit(AstVarScope* nodep) override { UASSERT_OBJ(m_currScopep, nodep, "AstVarScope not under AstScope"); // Prefilter - things that get added to m_vscps will either get traced or get a comment as @@ -345,13 +345,13 @@ private: } // VISITORS - Data types when tracing - virtual void visit(AstConstDType* nodep) override { + void visit(AstConstDType* nodep) override { if (m_traVscp) iterate(nodep->subDTypep()->skipRefToEnump()); } - virtual void visit(AstRefDType* nodep) override { + void visit(AstRefDType* nodep) override { if (m_traVscp) iterate(nodep->subDTypep()->skipRefToEnump()); } - virtual void visit(AstUnpackArrayDType* nodep) override { + void visit(AstUnpackArrayDType* nodep) override { // Note more specific dtypes above if (m_traVscp) { if (static_cast(nodep->arrayUnpackedElements()) > v3Global.opt.traceMaxArray()) { @@ -386,7 +386,7 @@ private: } } } - virtual void visit(AstPackArrayDType* nodep) override { + void visit(AstPackArrayDType* nodep) override { if (m_traVscp) { if (!v3Global.opt.traceStructs()) { // Everything downstream is packed, so deal with as one trace unit. @@ -412,7 +412,7 @@ private: } } } - virtual void visit(AstNodeUOrStructDType* nodep) override { + void visit(AstNodeUOrStructDType* nodep) override { if (m_traVscp) { if (nodep->packed() && !v3Global.opt.traceStructs()) { // Everything downstream is packed, so deal with as one trace unit @@ -449,7 +449,7 @@ private: } } } - virtual void visit(AstBasicDType* nodep) override { + void visit(AstBasicDType* nodep) override { if (m_traVscp) { if (nodep->isString()) { addIgnore("Unsupported: strings"); @@ -458,15 +458,15 @@ private: } } } - virtual void visit(AstEnumDType* nodep) override { iterate(nodep->skipRefp()); } - virtual void visit(AstNodeDType*) override { + void visit(AstEnumDType* nodep) override { iterate(nodep->skipRefp()); } + void visit(AstNodeDType*) override { // Note more specific dtypes above if (!m_traVscp) return; addIgnore("Unsupported: data type"); } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -513,7 +513,7 @@ public: AstCFunc* const topFuncp = m_topFuncps.front(); topFuncp->name("trace_init_top"); } - virtual ~TraceDeclVisitor() override { + ~TraceDeclVisitor() override { V3Stats::addStat("Tracing, Traced signals", m_statSigs); V3Stats::addStat("Tracing, Ignored signals", m_statIgnSigs); } diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 733d4ad74..5a04e135e 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -118,17 +118,17 @@ public: TristateVertex(V3Graph* graphp, AstNode* nodep) : V3GraphVertex{graphp} , m_nodep{nodep} {} - virtual ~TristateVertex() override = default; + ~TristateVertex() override = default; // ACCESSORS AstNode* nodep() const { return m_nodep; } const AstVar* varp() const { return VN_CAST(nodep(), Var); } - virtual string name() const override { + string name() const override { return ((isTristate() ? "tri\\n" : feedsTri() ? "feed\\n" : "-\\n") + (nodep()->prettyTypeName() + " " + cvtToHex(nodep()))); } - virtual string dotColor() const override { + string dotColor() const override { return (varp() ? (isTristate() ? "darkblue" : feedsTri() ? "blue" : "lightblue") @@ -136,7 +136,7 @@ public: : feedsTri() ? "green" : "lightgreen")); } - virtual FileLine* fileline() const override { return nodep()->fileline(); } + FileLine* fileline() const override { return nodep()->fileline(); } void isTristate(bool flag) { m_isTristate = flag; } bool isTristate() const { return m_isTristate; } void feedsTri(bool flag) { m_feedsTri = flag; } @@ -312,7 +312,7 @@ class TristatePinVisitor final : public TristateBaseVisitor { TristateGraph& m_tgraph; const bool m_lvalue; // Flip to be an LVALUE // VISITORS - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { UASSERT_OBJ(!nodep->access().isRW(), nodep, "Tristate unexpected on R/W access flip"); if (m_lvalue && !nodep->access().isWriteOrRW()) { UINFO(9, " Flip-to-LValue " << nodep << endl); @@ -325,17 +325,17 @@ class TristatePinVisitor final : public TristateBaseVisitor { m_tgraph.setTristate(nodep->varp()); } } - virtual void visit(AstArraySel* nodep) override { + void visit(AstArraySel* nodep) override { // Doesn't work because we'd set lvalue on the array index's var UASSERT_OBJ(!m_lvalue, nodep, "ArraySel conversion to output, under tristate node"); iterateChildren(nodep); } - virtual void visit(AstSliceSel* nodep) override { + void visit(AstSliceSel* nodep) override { // Doesn't work because we'd set lvalue on the array index's var UASSERT_OBJ(!m_lvalue, nodep, "SliceSel conversion to output, under tristate node"); iterateChildren(nodep); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -344,7 +344,7 @@ public: , m_lvalue{lvalue} { iterate(nodep); } - virtual ~TristatePinVisitor() override = default; + ~TristatePinVisitor() override = default; }; //###################################################################### @@ -778,7 +778,7 @@ class TristateVisitor final : public TristateBaseVisitor { } // VISITORS - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { UINFO(9, dbgState() << nodep << endl); if (m_graphing) { if (!m_alhs && nodep->num().hasZ()) m_tgraph.setTristate(nodep); @@ -811,7 +811,7 @@ class TristateVisitor final : public TristateBaseVisitor { } } - virtual void visit(AstCond* nodep) override { + void visit(AstCond* nodep) override { if (m_graphing) { iterateChildren(nodep); if (m_alhs) { @@ -856,7 +856,7 @@ class TristateVisitor final : public TristateBaseVisitor { } } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { if (m_graphing) { iterateChildren(nodep); if (m_alhs) { @@ -895,7 +895,7 @@ class TristateVisitor final : public TristateBaseVisitor { } } - virtual void visit(AstConcat* nodep) override { + void visit(AstConcat* nodep) override { if (m_graphing) { iterateChildren(nodep); if (m_alhs) { @@ -941,7 +941,7 @@ class TristateVisitor final : public TristateBaseVisitor { } } - virtual void visit(AstBufIf1* nodep) override { + void visit(AstBufIf1* nodep) override { // For BufIf1, the enable is the LHS expression iterateChildren(nodep); UINFO(9, dbgState() << nodep << endl); @@ -1025,8 +1025,8 @@ class TristateVisitor final : public TristateBaseVisitor { expr2p->user1p(nullptr); } } - virtual void visit(AstAnd* nodep) override { visitAndOr(nodep, true); } - virtual void visit(AstOr* nodep) override { visitAndOr(nodep, false); } + void visit(AstAnd* nodep) override { visitAndOr(nodep, true); } + void visit(AstOr* nodep) override { visitAndOr(nodep, false); } void visitAssign(AstNodeAssign* nodep) { if (m_graphing) { @@ -1065,8 +1065,8 @@ class TristateVisitor final : public TristateBaseVisitor { m_alhs = false; } } - virtual void visit(AstAssignW* nodep) override { visitAssign(nodep); } - virtual void visit(AstAssign* nodep) override { visitAssign(nodep); } + void visit(AstAssignW* nodep) override { visitAssign(nodep); } + void visit(AstAssign* nodep) override { visitAssign(nodep); } void visitCaseEq(AstNodeBiop* nodep, bool neq) { if (m_graphing) { @@ -1136,12 +1136,12 @@ class TristateVisitor final : public TristateBaseVisitor { return; } } - virtual void visit(AstEqCase* nodep) override { visitCaseEq(nodep, false); } - virtual void visit(AstNeqCase* nodep) override { visitCaseEq(nodep, true); } - virtual void visit(AstEqWild* nodep) override { visitEqNeqWild(nodep); } - virtual void visit(AstNeqWild* nodep) override { visitEqNeqWild(nodep); } + void visit(AstEqCase* nodep) override { visitCaseEq(nodep, false); } + void visit(AstNeqCase* nodep) override { visitCaseEq(nodep, true); } + void visit(AstEqWild* nodep) override { visitEqNeqWild(nodep); } + void visit(AstNeqWild* nodep) override { visitEqNeqWild(nodep); } - virtual void visit(AstCountBits* nodep) override { + void visit(AstCountBits* nodep) override { std::array dropop; dropop[0] = VN_IS(nodep->rhsp(), Const) && VN_AS(nodep->rhsp(), Const)->num().isAnyZ(); dropop[1] = VN_IS(nodep->thsp(), Const) && VN_AS(nodep->thsp(), Const)->num().isAnyZ(); @@ -1201,7 +1201,7 @@ class TristateVisitor final : public TristateBaseVisitor { iterateChildren(nodep); } } - virtual void visit(AstPull* nodep) override { + void visit(AstPull* nodep) override { UINFO(9, dbgState() << nodep << endl); AstVarRef* varrefp = nullptr; if (VN_IS(nodep->lhsp(), VarRef)) { @@ -1276,7 +1276,7 @@ class TristateVisitor final : public TristateBaseVisitor { // __out(to-resolver-only) // const inout Spec says illegal // const output Unsupported; Illegal? - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { if (m_graphing) { if (nodep->user2() & U2_GRAPHING) return; // This pin is already expanded nodep->user2(U2_GRAPHING); @@ -1445,7 +1445,7 @@ class TristateVisitor final : public TristateBaseVisitor { } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { UINFO(9, dbgState() << nodep << endl); if (m_graphing) { if (nodep->access().isWriteOrRW()) associateLogic(nodep, nodep->varp()); @@ -1477,7 +1477,7 @@ class TristateVisitor final : public TristateBaseVisitor { } } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { iterateChildren(nodep); UINFO(9, dbgState() << nodep << endl); if (m_graphing) { @@ -1510,7 +1510,7 @@ class TristateVisitor final : public TristateBaseVisitor { } } - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { UINFO(8, nodep << endl); VL_RESTORER(m_modp); VL_RESTORER(m_graphing); @@ -1546,29 +1546,29 @@ class TristateVisitor final : public TristateBaseVisitor { m_tgraph.clear(); // Recursion not supported } - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { // don't deal with classes } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { // don't deal with functions } - virtual void visit(AstCaseItem* nodep) override { + void visit(AstCaseItem* nodep) override { // don't deal with casez compare '???? values iterateAndNextNull(nodep->bodysp()); } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { VL_RESTORER(m_cellp); m_cellp = nodep; m_alhs = false; iterateChildren(nodep); } - virtual void visit(AstNetlist* nodep) override { iterateChildrenBackwards(nodep); } + void visit(AstNetlist* nodep) override { iterateChildrenBackwards(nodep); } // Default: Just iterate - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { iterateChildren(nodep); checkUnhandled(nodep); } @@ -1579,7 +1579,7 @@ public: m_tgraph.clear(); iterate(nodep); } - virtual ~TristateVisitor() override { + ~TristateVisitor() override { V3Stats::addStat("Tristate, Tristate resolved nets", m_statTriSigs); } }; diff --git a/src/V3Undriven.cpp b/src/V3Undriven.cpp index 4f6374cde..1cf0f125d 100644 --- a/src/V3Undriven.cpp +++ b/src/V3Undriven.cpp @@ -294,7 +294,7 @@ private: } // VISITORS - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { for (int usr = 1; usr < (m_alwaysCombp ? 3 : 2); ++usr) { // For assigns and non-combo always, do just usr==1, to look // for module-wide undriven etc. @@ -315,15 +315,15 @@ private: // Discover variables used in bit definitions, etc iterateChildren(nodep); } - virtual void visit(AstArraySel* nodep) override { + void visit(AstArraySel* nodep) override { // Arrays are rarely constant assigned, so for now we punt and do all entries iterateChildren(nodep); } - virtual void visit(AstSliceSel* nodep) override { + void visit(AstSliceSel* nodep) override { // Arrays are rarely constant assigned, so for now we punt and do all entries iterateChildren(nodep); } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { AstNodeVarRef* const varrefp = VN_CAST(nodep->fromp(), NodeVarRef); AstConst* const constp = VN_CAST(nodep->lsbp(), Const); if (varrefp && constp && !constp->num().isFourState()) { @@ -347,7 +347,7 @@ private: iterateChildren(nodep); } } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { // Any variable if (nodep->access().isWriteOrRW() && !VN_IS(nodep, VarXRef)) { // Ignore interface variables and similar ugly items @@ -388,7 +388,7 @@ private: } // Don't know what black boxed calls do, assume in+out - virtual void visit(AstSysIgnore* nodep) override { + void visit(AstSysIgnore* nodep) override { VL_RESTORER(m_inBBox); { m_inBBox = true; @@ -396,28 +396,28 @@ private: } } - virtual void visit(AstAssign* nodep) override { + void visit(AstAssign* nodep) override { VL_RESTORER(m_inProcAssign); { m_inProcAssign = true; iterateChildren(nodep); } } - virtual void visit(AstAssignDly* nodep) override { + void visit(AstAssignDly* nodep) override { VL_RESTORER(m_inProcAssign); { m_inProcAssign = true; iterateChildren(nodep); } } - virtual void visit(AstAssignW* nodep) override { + void visit(AstAssignW* nodep) override { VL_RESTORER(m_inContAssign); { m_inContAssign = true; iterateChildren(nodep); } } - virtual void visit(AstAlways* nodep) override { + void visit(AstAlways* nodep) override { VL_RESTORER(m_alwaysCombp); { AstNode::user2ClearTree(); @@ -432,37 +432,37 @@ private: } } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { VL_RESTORER(m_taskp); { m_taskp = nodep; iterateChildren(nodep); } } - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { VL_RESTORER(m_inInoutPin); m_inInoutPin = nodep->modVarp()->isInoutish(); iterateChildren(nodep); } // Until we support tables, primitives will have undriven and unused I/Os - virtual void visit(AstPrimitive*) override {} + void visit(AstPrimitive*) override {} // Coverage artifacts etc shouldn't count as a sink - virtual void visit(AstCoverDecl*) override {} - virtual void visit(AstCoverInc*) override {} - virtual void visit(AstCoverToggle*) override {} - virtual void visit(AstTraceDecl*) override {} - virtual void visit(AstTraceInc*) override {} + void visit(AstCoverDecl*) override {} + void visit(AstCoverInc*) override {} + void visit(AstCoverToggle*) override {} + void visit(AstTraceDecl*) override {} + void visit(AstTraceInc*) override {} // iterate - virtual void visit(AstConst* nodep) override {} - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstConst* nodep) override {} + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS explicit UndrivenVisitor(AstNetlist* nodep) { iterate(nodep); } - virtual ~UndrivenVisitor() override { + ~UndrivenVisitor() override { for (UndrivenVarEntry* ip : m_entryps[1]) ip->reportViolations(); for (int usr = 1; usr < 3; ++usr) { for (UndrivenVarEntry* ip : m_entryps[usr]) delete ip; diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 5d027a135..bd91ad005 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -138,7 +138,7 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { UINFO(4, " MOD " << nodep << endl); VL_RESTORER(m_modp); VL_RESTORER(m_constXCvt); @@ -153,21 +153,21 @@ private: iterateChildren(nodep); } } - virtual void visit(AstAssignDly* nodep) override { + void visit(AstAssignDly* nodep) override { VL_RESTORER(m_assigndlyp); { m_assigndlyp = nodep; VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep. } } - virtual void visit(AstAssignW* nodep) override { + void visit(AstAssignW* nodep) override { VL_RESTORER(m_assignwp); { m_assignwp = nodep; VL_DO_DANGLING(iterateChildren(nodep), nodep); // May delete nodep. } } - virtual void visit(AstCaseItem* nodep) override { + void visit(AstCaseItem* nodep) override { VL_RESTORER(m_constXCvt); { m_constXCvt = false; // Avoid losing the X's in casex @@ -176,7 +176,7 @@ private: iterateAndNextNull(nodep->bodysp()); } } - virtual void visit(AstNodeDType* nodep) override { + void visit(AstNodeDType* nodep) override { VL_RESTORER(m_constXCvt); { m_constXCvt = false; // Avoid losing the X's in casex @@ -255,11 +255,11 @@ private: } } - virtual void visit(AstEqCase* nodep) override { visitEqNeqCase(nodep); } - virtual void visit(AstNeqCase* nodep) override { visitEqNeqCase(nodep); } - virtual void visit(AstEqWild* nodep) override { visitEqNeqWild(nodep); } - virtual void visit(AstNeqWild* nodep) override { visitEqNeqWild(nodep); } - virtual void visit(AstIsUnknown* nodep) override { + void visit(AstEqCase* nodep) override { visitEqNeqCase(nodep); } + void visit(AstNeqCase* nodep) override { visitEqNeqCase(nodep); } + void visit(AstEqWild* nodep) override { visitEqNeqWild(nodep); } + void visit(AstNeqWild* nodep) override { visitEqNeqWild(nodep); } + void visit(AstIsUnknown* nodep) override { iterateChildren(nodep); // Ahh, we're two state, so this is easy UINFO(4, " ISUNKNOWN->0 " << nodep << endl); @@ -267,7 +267,7 @@ private: nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstCountBits* nodep) override { + void visit(AstCountBits* nodep) override { // Ahh, we're two state, so this is easy std::array dropop; dropop[0] = VN_IS(nodep->rhsp(), Const) && VN_AS(nodep->rhsp(), Const)->num().isAnyX(); @@ -303,7 +303,7 @@ private: } iterateChildren(nodep); } - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { if (m_constXCvt && nodep->num().isFourState()) { UINFO(4, " CONST4 " << nodep << endl); if (debug() >= 9) nodep->dumpTree(cout, " Const_old: "); @@ -364,7 +364,7 @@ private: } } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { iterateChildren(nodep); if (!nodep->user1SetOnce()) { // Guard against reading/writing past end of bit vector array @@ -411,7 +411,7 @@ private: // visit(AstSliceSel) not needed as its bounds are constant and checked // in V3Width. - virtual void visit(AstArraySel* nodep) override { + void visit(AstArraySel* nodep) override { iterateChildren(nodep); if (!nodep->user1SetOnce()) { if (debug() == 9) nodep->dumpTree(cout, "-in: "); @@ -482,7 +482,7 @@ private: } } //-------------------- - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS @@ -491,7 +491,7 @@ public: , m_xrandNames{"__Vxrand"} { iterate(nodep); } - virtual ~UnknownVisitor() override { // + ~UnknownVisitor() override { // V3Stats::addStat("Unknowns, variables created", m_statUnkVars); } }; diff --git a/src/V3Unroll.cpp b/src/V3Unroll.cpp index 0b47ce518..8c9bf96dd 100644 --- a/src/V3Unroll.cpp +++ b/src/V3Unroll.cpp @@ -371,7 +371,7 @@ private: return true; } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { iterateChildren(nodep); if (m_varModeCheck || m_varModeReplace) { } else { @@ -406,7 +406,7 @@ private: } } } - virtual void visit(AstGenFor* nodep) override { + void visit(AstGenFor* nodep) override { if (!m_generate || m_varModeReplace) { iterateChildren(nodep); } // else V3Param will recursively call each for loop to be unrolled for us @@ -433,7 +433,7 @@ private: } } } - virtual void visit(AstNodeFor* nodep) override { + void visit(AstNodeFor* nodep) override { if (m_generate) { // Ignore for's when expanding genfor's iterateChildren(nodep); } else { @@ -441,7 +441,7 @@ private: } } - virtual void visit(AstVarRef* nodep) override { + void visit(AstVarRef* nodep) override { if (m_varModeCheck && nodep->varp() == m_forVarp && nodep->varScopep() == m_forVscp && nodep->access().isWriteOrRW()) { UINFO(8, " Itervar assigned to: " << nodep << endl); @@ -458,7 +458,7 @@ private: //-------------------- // Default: Just iterate - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { if (m_varModeCheck && nodep == m_ignoreIncp) { // Ignore subtree that is the increment } else { @@ -469,7 +469,7 @@ private: public: // CONSTRUCTORS UnrollVisitor() { init(false, ""); } - virtual ~UnrollVisitor() override { + ~UnrollVisitor() override { V3Stats::addStatSum("Optimizations, Unrolled Loops", m_statLoops); V3Stats::addStatSum("Optimizations, Unrolled Iterations", m_statIters); } diff --git a/src/V3VariableOrder.cpp b/src/V3VariableOrder.cpp index d3ea7aa3d..5bd51933d 100644 --- a/src/V3VariableOrder.cpp +++ b/src/V3VariableOrder.cpp @@ -51,12 +51,12 @@ public: } ~VarTspSorter() override = default; // METHODS - virtual bool operator<(const TspStateBase& other) const override { + bool operator<(const TspStateBase& other) const override { return operator<(static_cast(other)); } bool operator<(const VarTspSorter& other) const { return m_serial < other.m_serial; } const MTaskIdSet& mtaskIds() const { return m_mtaskIds; } - virtual int cost(const TspStateBase* otherp) const override { + int cost(const TspStateBase* otherp) const override { return cost(static_cast(otherp)); } int cost(const VarTspSorter* otherp) const { diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 6a303ee0b..57fad0d7f 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -250,123 +250,119 @@ private: // _Ox=anything // Widths: 1 bit out, lhs 1 bit; Real: converts via compare with 0 - virtual void visit(AstLogNot* nodep) override { visit_log_not(nodep); } + void visit(AstLogNot* nodep) override { visit_log_not(nodep); } // Widths: 1 bit out, lhs 1 bit, rhs 1 bit; Real: converts via compare with 0 - virtual void visit(AstLogAnd* nodep) override { visit_log_and_or(nodep); } - virtual void visit(AstLogOr* nodep) override { visit_log_and_or(nodep); } - virtual void visit(AstLogEq* nodep) override { + void visit(AstLogAnd* nodep) override { visit_log_and_or(nodep); } + void visit(AstLogOr* nodep) override { visit_log_and_or(nodep); } + void visit(AstLogEq* nodep) override { // Conversion from real not in IEEE, but a fallout visit_log_and_or(nodep); } - virtual void visit(AstLogIf* nodep) override { + void visit(AstLogIf* nodep) override { // Conversion from real not in IEEE, but a fallout visit_log_and_or(nodep); } // Widths: 1 bit out, Any width lhs - virtual void visit(AstRedAnd* nodep) override { visit_red_and_or(nodep); } - virtual void visit(AstRedOr* nodep) override { visit_red_and_or(nodep); } - virtual void visit(AstRedXor* nodep) override { visit_red_and_or(nodep); } - virtual void visit(AstOneHot* nodep) override { visit_red_and_or(nodep); } - virtual void visit(AstOneHot0* nodep) override { visit_red_and_or(nodep); } - virtual void visit(AstIsUnknown* nodep) override { + void visit(AstRedAnd* nodep) override { visit_red_and_or(nodep); } + void visit(AstRedOr* nodep) override { visit_red_and_or(nodep); } + void visit(AstRedXor* nodep) override { visit_red_and_or(nodep); } + void visit(AstOneHot* nodep) override { visit_red_and_or(nodep); } + void visit(AstOneHot0* nodep) override { visit_red_and_or(nodep); } + void visit(AstIsUnknown* nodep) override { visit_red_unknown(nodep); // Allow real } // These have different node types, as they operate differently // Must add to case statement below, // Widths: 1 bit out, lhs width == rhs width. real if lhs|rhs real - virtual void visit(AstEq* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstNeq* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstGt* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstGte* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstLt* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstLte* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstGtS* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstGteS* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstLtS* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstLteS* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstEqCase* nodep) override { visit_cmp_eq_gt(nodep, true); } - virtual void visit(AstNeqCase* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstEq* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstNeq* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstGt* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstGte* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstLt* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstLte* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstGtS* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstGteS* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstLtS* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstLteS* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstEqCase* nodep) override { visit_cmp_eq_gt(nodep, true); } + void visit(AstNeqCase* nodep) override { visit_cmp_eq_gt(nodep, true); } // ... These comparisons don't allow reals - virtual void visit(AstEqWild* nodep) override { visit_cmp_eq_gt(nodep, false); } - virtual void visit(AstNeqWild* nodep) override { visit_cmp_eq_gt(nodep, false); } + void visit(AstEqWild* nodep) override { visit_cmp_eq_gt(nodep, false); } + void visit(AstNeqWild* nodep) override { visit_cmp_eq_gt(nodep, false); } // ... Real compares - virtual void visit(AstEqD* nodep) override { visit_cmp_real(nodep); } - virtual void visit(AstNeqD* nodep) override { visit_cmp_real(nodep); } - virtual void visit(AstLtD* nodep) override { visit_cmp_real(nodep); } - virtual void visit(AstLteD* nodep) override { visit_cmp_real(nodep); } - virtual void visit(AstGtD* nodep) override { visit_cmp_real(nodep); } - virtual void visit(AstGteD* nodep) override { visit_cmp_real(nodep); } + void visit(AstEqD* nodep) override { visit_cmp_real(nodep); } + void visit(AstNeqD* nodep) override { visit_cmp_real(nodep); } + void visit(AstLtD* nodep) override { visit_cmp_real(nodep); } + void visit(AstLteD* nodep) override { visit_cmp_real(nodep); } + void visit(AstGtD* nodep) override { visit_cmp_real(nodep); } + void visit(AstGteD* nodep) override { visit_cmp_real(nodep); } // ... String compares - virtual void visit(AstEqN* nodep) override { visit_cmp_string(nodep); } - virtual void visit(AstNeqN* nodep) override { visit_cmp_string(nodep); } - virtual void visit(AstLtN* nodep) override { visit_cmp_string(nodep); } - virtual void visit(AstLteN* nodep) override { visit_cmp_string(nodep); } - virtual void visit(AstGtN* nodep) override { visit_cmp_string(nodep); } - virtual void visit(AstGteN* nodep) override { visit_cmp_string(nodep); } + void visit(AstEqN* nodep) override { visit_cmp_string(nodep); } + void visit(AstNeqN* nodep) override { visit_cmp_string(nodep); } + void visit(AstLtN* nodep) override { visit_cmp_string(nodep); } + void visit(AstLteN* nodep) override { visit_cmp_string(nodep); } + void visit(AstGtN* nodep) override { visit_cmp_string(nodep); } + void visit(AstGteN* nodep) override { visit_cmp_string(nodep); } // Widths: out width = lhs width = rhs width // Signed: Output signed iff LHS & RHS signed. // Real: Not allowed - virtual void visit(AstAnd* nodep) override { visit_boolmath_and_or(nodep); } - virtual void visit(AstOr* nodep) override { visit_boolmath_and_or(nodep); } - virtual void visit(AstXor* nodep) override { visit_boolmath_and_or(nodep); } - virtual void visit(AstBufIf1* nodep) override { + void visit(AstAnd* nodep) override { visit_boolmath_and_or(nodep); } + void visit(AstOr* nodep) override { visit_boolmath_and_or(nodep); } + void visit(AstXor* nodep) override { visit_boolmath_and_or(nodep); } + void visit(AstBufIf1* nodep) override { visit_boolmath_and_or(nodep); } // Signed behavior changing in 3.814 // Width: Max(Lhs,Rhs) sort of. // Real: If either side real // Signed: If both sides real - virtual void visit(AstAdd* nodep) override { visit_add_sub_replace(nodep, true); } - virtual void visit(AstSub* nodep) override { visit_add_sub_replace(nodep, true); } - virtual void visit(AstDiv* nodep) override { visit_add_sub_replace(nodep, true); } - virtual void visit(AstMul* nodep) override { visit_add_sub_replace(nodep, true); } + void visit(AstAdd* nodep) override { visit_add_sub_replace(nodep, true); } + void visit(AstSub* nodep) override { visit_add_sub_replace(nodep, true); } + void visit(AstDiv* nodep) override { visit_add_sub_replace(nodep, true); } + void visit(AstMul* nodep) override { visit_add_sub_replace(nodep, true); } // These can't promote to real - virtual void visit(AstModDiv* nodep) override { visit_add_sub_replace(nodep, false); } - virtual void visit(AstModDivS* nodep) override { visit_add_sub_replace(nodep, false); } - virtual void visit(AstMulS* nodep) override { visit_add_sub_replace(nodep, false); } - virtual void visit(AstDivS* nodep) override { visit_add_sub_replace(nodep, false); } + void visit(AstModDiv* nodep) override { visit_add_sub_replace(nodep, false); } + void visit(AstModDivS* nodep) override { visit_add_sub_replace(nodep, false); } + void visit(AstMulS* nodep) override { visit_add_sub_replace(nodep, false); } + void visit(AstDivS* nodep) override { visit_add_sub_replace(nodep, false); } // Widths: out width = lhs width, but upper matters // Signed: Output signed iff LHS signed; unary operator // Unary promote to real - virtual void visit(AstNegate* nodep) override { visit_negate_not(nodep, true); } + void visit(AstNegate* nodep) override { visit_negate_not(nodep, true); } // Unary never real - virtual void visit(AstNot* nodep) override { visit_negate_not(nodep, false); } + void visit(AstNot* nodep) override { visit_negate_not(nodep, false); } // Real: inputs and output real - virtual void visit(AstAddD* nodep) override { visit_real_add_sub(nodep); } - virtual void visit(AstSubD* nodep) override { visit_real_add_sub(nodep); } - virtual void visit(AstDivD* nodep) override { visit_real_add_sub(nodep); } - virtual void visit(AstMulD* nodep) override { visit_real_add_sub(nodep); } - virtual void visit(AstPowD* nodep) override { visit_real_add_sub(nodep); } - virtual void visit(AstNodeSystemBiop* nodep) override { visit_real_add_sub(nodep); } + void visit(AstAddD* nodep) override { visit_real_add_sub(nodep); } + void visit(AstSubD* nodep) override { visit_real_add_sub(nodep); } + void visit(AstDivD* nodep) override { visit_real_add_sub(nodep); } + void visit(AstMulD* nodep) override { visit_real_add_sub(nodep); } + void visit(AstPowD* nodep) override { visit_real_add_sub(nodep); } + void visit(AstNodeSystemBiop* nodep) override { visit_real_add_sub(nodep); } // Real: Output real - virtual void visit(AstNegateD* nodep) override { visit_real_neg_ceil(nodep); } - virtual void visit(AstNodeSystemUniop* nodep) override { visit_real_neg_ceil(nodep); } + void visit(AstNegateD* nodep) override { visit_real_neg_ceil(nodep); } + void visit(AstNodeSystemUniop* nodep) override { visit_real_neg_ceil(nodep); } // Widths: out signed/unsigned width = lhs width, input un|signed - virtual void visit(AstSigned* nodep) override { - visit_signed_unsigned(nodep, VSigning::SIGNED); - } - virtual void visit(AstUnsigned* nodep) override { - visit_signed_unsigned(nodep, VSigning::UNSIGNED); - } + void visit(AstSigned* nodep) override { visit_signed_unsigned(nodep, VSigning::SIGNED); } + void visit(AstUnsigned* nodep) override { visit_signed_unsigned(nodep, VSigning::UNSIGNED); } // Widths: Output width from lhs, rhs<33 bits // Signed: If lhs signed - virtual void visit(AstShiftL* nodep) override { visit_shift(nodep); } - virtual void visit(AstShiftR* nodep) override { visit_shift(nodep); } + void visit(AstShiftL* nodep) override { visit_shift(nodep); } + void visit(AstShiftR* nodep) override { visit_shift(nodep); } // ShiftRS converts to ShiftR, but not vice-versa - virtual void visit(AstShiftRS* nodep) override { visit_shift(nodep); } + void visit(AstShiftRS* nodep) override { visit_shift(nodep); } //======== // Widths: Output real, input integer signed - virtual void visit(AstBitsToRealD* nodep) override { visit_Or_Lu64(nodep); } + void visit(AstBitsToRealD* nodep) override { visit_Or_Lu64(nodep); } // Widths: Output integer signed, input real - virtual void visit(AstRToIS* nodep) override { visit_Os32_Lr(nodep); } - virtual void visit(AstRToIRoundS* nodep) override { + void visit(AstRToIS* nodep) override { visit_Os32_Lr(nodep); } + void visit(AstRToIRoundS* nodep) override { // Only created here, size comes from upper expression if (m_vup->prelim()) { // First stage evaluation iterateCheckReal(nodep, "LHS", nodep->lhsp(), BOTH); @@ -375,11 +371,11 @@ private: } // Widths: Output integer unsigned, input real - virtual void visit(AstRealToBits* nodep) override { visit_Ou64_Lr(nodep); } + void visit(AstRealToBits* nodep) override { visit_Ou64_Lr(nodep); } // Output integer, input string - virtual void visit(AstLenN* nodep) override { visit_Os32_string(nodep); } - virtual void visit(AstPutcN* nodep) override { + void visit(AstLenN* nodep) override { visit_Os32_string(nodep); } + void visit(AstPutcN* nodep) override { // CALLER: str.putc() UASSERT_OBJ(nodep->rhsp() && nodep->thsp(), nodep, "For ternary ops only!"); if (m_vup && m_vup->prelim()) { @@ -391,7 +387,7 @@ private: // AstAssign } } - virtual void visit(AstGetcN* nodep) override { + void visit(AstGetcN* nodep) override { // CALLER: str.getc() UASSERT_OBJ(nodep->rhsp(), nodep, "For binary ops only!"); if (m_vup && m_vup->prelim()) { @@ -401,7 +397,7 @@ private: nodep->dtypeSetBitSized(8, VSigning::UNSIGNED); } } - virtual void visit(AstGetcRefN* nodep) override { + void visit(AstGetcRefN* nodep) override { // CALLER: str.getc() UASSERT_OBJ(nodep->rhsp(), nodep, "For binary ops only!"); if (m_vup && m_vup->prelim()) { @@ -411,7 +407,7 @@ private: nodep->dtypeSetBitSized(8, VSigning::UNSIGNED); } } - virtual void visit(AstSubstrN* nodep) override { + void visit(AstSubstrN* nodep) override { // CALLER: str.substr() UASSERT_OBJ(nodep->rhsp() && nodep->thsp(), nodep, "For ternary ops only!"); if (m_vup && m_vup->prelim()) { @@ -422,7 +418,7 @@ private: nodep->dtypeSetString(); } } - virtual void visit(AstCompareNN* nodep) override { + void visit(AstCompareNN* nodep) override { // CALLER: str.compare(), str.icompare() // Widths: 32 bit out UASSERT_OBJ(nodep->rhsp(), nodep, "For binary ops only!"); @@ -433,7 +429,7 @@ private: nodep->dtypeSetSigned32(); } } - virtual void visit(AstAtoN* nodep) override { + void visit(AstAtoN* nodep) override { // CALLER: str.atobin(), atoi(), atohex(), atooct(), atoreal() // Width: 64bit floating point for atoreal(), 32bit out for the others if (m_vup->prelim()) { @@ -448,13 +444,13 @@ private: } // Widths: Constant, terminal - virtual void visit(AstTime* nodep) override { nodep->dtypeSetUInt64(); } - virtual void visit(AstTimeD* nodep) override { nodep->dtypeSetDouble(); } - virtual void visit(AstScopeName* nodep) override { + void visit(AstTime* nodep) override { nodep->dtypeSetUInt64(); } + void visit(AstTimeD* nodep) override { nodep->dtypeSetDouble(); } + void visit(AstScopeName* nodep) override { nodep->dtypeSetUInt64(); // A pointer, but not that it matters } - virtual void visit(AstNodeCond* nodep) override { + void visit(AstNodeCond* nodep) override { // op = cond ? expr1 : expr2 // See IEEE-2012 11.4.11 and Table 11-21. // LHS is self-determined @@ -496,7 +492,7 @@ private: EXTEND_EXP); } } - virtual void visit(AstConcat* nodep) override { + void visit(AstConcat* nodep) override { // Real: Not allowed (assumed) // Signed: unsigned output, input either (assumed) // IEEE-2012 Table 11-21, and 11.8.1: @@ -579,7 +575,7 @@ private: } } } - virtual void visit(AstConcatN* nodep) override { + void visit(AstConcatN* nodep) override { // String concatenate. // Already did AstConcat simplifications if (m_vup->prelim()) { @@ -595,7 +591,7 @@ private: } } } - virtual void visit(AstDelay* nodep) override { + void visit(AstDelay* nodep) override { if (VN_IS(m_procedurep, Final)) { nodep->v3error("Delays are not legal in final blocks (IEEE 1800-2017 9.2.3)"); VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep); @@ -611,7 +607,7 @@ private: nodep->v3warn(STMTDLY, "Unsupported: Ignoring delay on this delayed statement."); VL_DO_DANGLING(pushDeletep(nodep->unlinkFrBack()), nodep); } - virtual void visit(AstFork* nodep) override { + void visit(AstFork* nodep) override { if (VN_IS(m_ftaskp, Func) && !nodep->joinType().joinNone()) { nodep->v3error("Only fork .. join_none is legal in functions. " "(IEEE 1800-2017 13.4.4)"); @@ -633,27 +629,27 @@ private: // TBD might support only normal join, if so complain about other join flavors } } - virtual void visit(AstDisableFork* nodep) override { + void visit(AstDisableFork* nodep) override { nodep->v3warn(E_UNSUPPORTED, "Unsupported: disable fork statements"); VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstWaitFork* nodep) override { + void visit(AstWaitFork* nodep) override { nodep->v3warn(E_UNSUPPORTED, "Unsupported: wait fork statements"); VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstToLowerN* nodep) override { + void visit(AstToLowerN* nodep) override { if (m_vup->prelim()) { iterateCheckString(nodep, "LHS", nodep->lhsp(), BOTH); nodep->dtypeSetString(); } } - virtual void visit(AstToUpperN* nodep) override { + void visit(AstToUpperN* nodep) override { if (m_vup->prelim()) { iterateCheckString(nodep, "LHS", nodep->lhsp(), BOTH); nodep->dtypeSetString(); } } - virtual void visit(AstReplicate* nodep) override { + void visit(AstReplicate* nodep) override { // IEEE-2012 Table 11-21: // LHS, RHS is self-determined // width: value(LHS) * width(RHS) @@ -714,7 +710,7 @@ private: } } } - virtual void visit(AstReplicateN* nodep) override { + void visit(AstReplicateN* nodep) override { // Replicate with string if (m_vup->prelim()) { iterateCheckString(nodep, "LHS", nodep->lhsp(), BOTH); @@ -741,7 +737,7 @@ private: } } } - virtual void visit(AstNodeStream* nodep) override { + void visit(AstNodeStream* nodep) override { if (m_vup->prelim()) { iterateCheckSizedSelf(nodep, "LHS", nodep->lhsp(), SELF, BOTH); iterateCheckSizedSelf(nodep, "RHS", nodep->rhsp(), SELF, BOTH); @@ -774,7 +770,7 @@ private: } } } - virtual void visit(AstRange* nodep) override { + void visit(AstRange* nodep) override { // Real: Not allowed // Signed: unsigned output, input either // Convert all range values to constants @@ -800,7 +796,7 @@ private: } } - virtual void visit(AstSel* nodep) override { + void visit(AstSel* nodep) override { // Signed: always unsigned; Real: Not allowed // LSB is self-determined (IEEE 2012 11.5.1) // We also use SELs to shorten a signed constant etc, in this case they are signed. @@ -907,7 +903,7 @@ private: } } - virtual void visit(AstArraySel* nodep) override { + void visit(AstArraySel* nodep) override { // Signed/Real: Output signed iff LHS signed/real; binary operator // Note by contrast, bit extract selects are unsigned // LSB is self-determined (IEEE 2012 11.5.1) @@ -969,7 +965,7 @@ private: } } - virtual void visit(AstAssocSel* nodep) override { + void visit(AstAssocSel* nodep) override { // Signed/Real: Output type based on array-declared type; binary operator if (m_vup->prelim()) { const AstNodeDType* const fromDtp = nodep->fromp()->dtypep()->skipRefp(); @@ -984,7 +980,7 @@ private: } } - virtual void visit(AstWildcardSel* nodep) override { + void visit(AstWildcardSel* nodep) override { // Signed/Real: Output type based on array-declared type; binary operator if (m_vup->prelim()) { const AstNodeDType* const fromDtp = nodep->fromp()->dtypep()->skipRefp(); @@ -1005,7 +1001,7 @@ private: } } - virtual void visit(AstSliceSel* nodep) override { + void visit(AstSliceSel* nodep) override { // Always creates as output an unpacked array if (m_vup->prelim()) { userIterateAndNext(nodep->fromp(), WidthVP(SELF, BOTH).p()); @@ -1049,7 +1045,7 @@ private: } } - virtual void visit(AstSelBit* nodep) override { + void visit(AstSelBit* nodep) override { // Just a quick check as after V3Param these nodes instead are AstSel's userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT, PRELIM).p()); // FINAL in AstSel userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT, PRELIM).p()); // FINAL in AstSel @@ -1063,7 +1059,7 @@ private: } nodep->v3fatalSrc("AstSelBit should disappear after widthSel"); } - virtual void visit(AstSelExtract* nodep) override { + void visit(AstSelExtract* nodep) override { // Just a quick check as after V3Param these nodes instead are AstSel's userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT, PRELIM).p()); // FINAL in AstSel userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT, PRELIM).p()); // FINAL in AstSel @@ -1077,7 +1073,7 @@ private: } nodep->v3fatalSrc("AstSelExtract should disappear after widthSel"); } - virtual void visit(AstSelPlus* nodep) override { + void visit(AstSelPlus* nodep) override { userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT, PRELIM).p()); // FINAL in AstSel userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT, PRELIM).p()); // FINAL in AstSel userIterateAndNext(nodep->thsp(), WidthVP(CONTEXT, PRELIM).p()); // FINAL in AstSel @@ -1090,7 +1086,7 @@ private: } nodep->v3fatalSrc("AstSelPlus should disappear after widthSel"); } - virtual void visit(AstSelMinus* nodep) override { + void visit(AstSelMinus* nodep) override { userIterateAndNext(nodep->fromp(), WidthVP(CONTEXT, PRELIM).p()); // FINAL in AstSel userIterateAndNext(nodep->rhsp(), WidthVP(CONTEXT, PRELIM).p()); // FINAL in AstSel userIterateAndNext(nodep->thsp(), WidthVP(CONTEXT, PRELIM).p()); // FINAL in AstSel @@ -1104,13 +1100,13 @@ private: nodep->v3fatalSrc("AstSelMinus should disappear after widthSel"); } - virtual void visit(AstExtend* nodep) override { + void visit(AstExtend* nodep) override { // Only created by this process, so we know width from here down is correct. } - virtual void visit(AstExtendS* nodep) override { + void visit(AstExtendS* nodep) override { // Only created by this process, so we know width from here down is correct. } - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { // The node got setup with the signed/real state of the node. // However a later operation may have changed the node->signed w/o changing // the number's sign. So we don't: nodep->dtypeChgSigned(nodep->num().isSigned()); @@ -1126,20 +1122,20 @@ private: // We don't size the constant until we commit the widths, as need parameters // to remain unsized, and numbers to remain unsized to avoid backp() warnings } - virtual void visit(AstEmptyQueue* nodep) override { + void visit(AstEmptyQueue* nodep) override { nodep->dtypeSetEmptyQueue(); if (!VN_IS(nodep->backp(), Assign)) { nodep->v3warn(E_UNSUPPORTED, "Unsupported/Illegal: empty queue ('{}') in this context"); } } - virtual void visit(AstFell* nodep) override { + void visit(AstFell* nodep) override { if (m_vup->prelim()) { iterateCheckSizedSelf(nodep, "LHS", nodep->exprp(), SELF, BOTH); nodep->dtypeSetBit(); } } - virtual void visit(AstPast* nodep) override { + void visit(AstPast* nodep) override { if (m_vup->prelim()) { iterateCheckSizedSelf(nodep, "LHS", nodep->exprp(), SELF, BOTH); nodep->dtypeFrom(nodep->exprp()); @@ -1163,28 +1159,28 @@ private: } } } - virtual void visit(AstRose* nodep) override { + void visit(AstRose* nodep) override { if (m_vup->prelim()) { iterateCheckSizedSelf(nodep, "LHS", nodep->exprp(), SELF, BOTH); nodep->dtypeSetBit(); } } - virtual void visit(AstSampled* nodep) override { + void visit(AstSampled* nodep) override { if (m_vup->prelim()) { iterateCheckSizedSelf(nodep, "LHS", nodep->exprp(), SELF, BOTH); nodep->dtypeFrom(nodep->exprp()); } } - virtual void visit(AstStable* nodep) override { + void visit(AstStable* nodep) override { if (m_vup->prelim()) { iterateCheckSizedSelf(nodep, "LHS", nodep->exprp(), SELF, BOTH); nodep->dtypeSetBit(); } } - virtual void visit(AstImplication* nodep) override { + void visit(AstImplication* nodep) override { if (m_vup->prelim()) { iterateCheckBool(nodep, "LHS", nodep->lhsp(), BOTH); iterateCheckBool(nodep, "RHS", nodep->rhsp(), BOTH); @@ -1192,7 +1188,7 @@ private: } } - virtual void visit(AstRand* nodep) override { + void visit(AstRand* nodep) override { if (m_vup->prelim()) { if (nodep->urandom()) { nodep->dtypeSetUInt32(); // Says the spec @@ -1202,7 +1198,7 @@ private: if (nodep->seedp()) iterateCheckSigned32(nodep, "seed", nodep->seedp(), BOTH); } } - virtual void visit(AstURandomRange* nodep) override { + void visit(AstURandomRange* nodep) override { if (m_vup->prelim()) { nodep->dtypeSetUInt32(); // Says the spec AstNodeDType* const expDTypep = nodep->findUInt32DType(); @@ -1212,7 +1208,7 @@ private: iterateCheck(nodep, "RHS", nodep->rhsp(), SELF, FINAL, expDTypep, EXTEND_EXP); } } - virtual void visit(AstUnbounded* nodep) override { + void visit(AstUnbounded* nodep) override { nodep->dtypeSetSigned32(); // Used in int context if (VN_IS(nodep->backp(), IsUnbounded)) return; // Ok, leave if (VN_IS(nodep->backp(), BracketArrayDType)) return; // Ok, leave @@ -1230,13 +1226,13 @@ private: } nodep->v3warn(E_UNSUPPORTED, "Unsupported/illegal unbounded ('$') in this context."); } - virtual void visit(AstIsUnbounded* nodep) override { + void visit(AstIsUnbounded* nodep) override { if (m_vup->prelim()) { userIterateAndNext(nodep->lhsp(), WidthVP(SELF, BOTH).p()); nodep->dtypeSetBit(); } } - virtual void visit(AstUCFunc* nodep) override { + void visit(AstUCFunc* nodep) override { // Give it the size the user wants. if (m_vup && m_vup->prelim()) { nodep->dtypeSetLogicUnsized(32, 1, VSigning::UNSIGNED); // We don't care @@ -1251,10 +1247,10 @@ private: } } } - virtual void visit(AstCLog2* nodep) override { + void visit(AstCLog2* nodep) override { if (m_vup->prelim()) { iterateCheckSizedSelf(nodep, "LHS", nodep->lhsp(), SELF, BOTH); } } - virtual void visit(AstPow* nodep) override { + void visit(AstPow* nodep) override { // Pow is special, output sign only depends on LHS sign, but // function result depends on both signs // RHS is self-determined (IEEE) @@ -1298,25 +1294,25 @@ private: } } } - virtual void visit(AstPowSU* nodep) override { + void visit(AstPowSU* nodep) override { // POWSU/SS/US only created here, dtype already determined, so // nothing to do in this function userIterateAndNext(nodep->lhsp(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->rhsp(), WidthVP(SELF, BOTH).p()); } - virtual void visit(AstPowSS* nodep) override { + void visit(AstPowSS* nodep) override { // POWSU/SS/US only created here, dtype already determined, so // nothing to do in this function userIterateAndNext(nodep->lhsp(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->rhsp(), WidthVP(SELF, BOTH).p()); } - virtual void visit(AstPowUS* nodep) override { + void visit(AstPowUS* nodep) override { // POWSU/SS/US only created here, dtype already determined, so // nothing to do in this function userIterateAndNext(nodep->lhsp(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->rhsp(), WidthVP(SELF, BOTH).p()); } - virtual void visit(AstCountBits* nodep) override { + void visit(AstCountBits* nodep) override { if (m_vup->prelim()) { iterateCheckSizedSelf(nodep, "LHS", nodep->lhsp(), SELF, BOTH); iterateCheckSizedSelf(nodep, "RHS", nodep->rhsp(), SELF, BOTH); @@ -1328,7 +1324,7 @@ private: VSigning::UNSIGNED); // Spec doesn't indicate if an integer } } - virtual void visit(AstCountOnes* nodep) override { + void visit(AstCountOnes* nodep) override { if (m_vup->prelim()) { iterateCheckSizedSelf(nodep, "LHS", nodep->lhsp(), SELF, BOTH); // If it's a 32 bit number, we need a 6 bit number as we need to return '32'. @@ -1337,12 +1333,12 @@ private: VSigning::UNSIGNED); // Spec doesn't indicate if an integer } } - virtual void visit(AstCvtPackString* nodep) override { + void visit(AstCvtPackString* nodep) override { // Opaque returns, so arbitrary userIterateAndNext(nodep->lhsp(), WidthVP(SELF, BOTH).p()); // Type set in constructor } - virtual void visit(AstTimeImport* nodep) override { + void visit(AstTimeImport* nodep) override { // LHS is a real number in seconds // Need to round to time units and precision userIterateAndNext(nodep->lhsp(), WidthVP(SELF, BOTH).p()); @@ -1357,14 +1353,14 @@ private: nodep->replaceWith(newp); VL_DO_DANGLING(nodep->deleteTree(), nodep); } - virtual void visit(AstEventControl* nodep) override { + void visit(AstEventControl* nodep) override { nodep->v3warn(E_UNSUPPORTED, "Unsupported: event control statement in this location\n" << nodep->warnMore() << "... Suggest have one event control statement " << "per procedure, at the top of the procedure"); VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } - virtual void visit(AstAttrOf* nodep) override { + void visit(AstAttrOf* nodep) override { VL_RESTORER(m_attrp); m_attrp = nodep; userIterateAndNext(nodep->fromp(), WidthVP(SELF, BOTH).p()); @@ -1497,16 +1493,16 @@ private: } } } - virtual void visit(AstPull* nodep) override { + void visit(AstPull* nodep) override { // May have select underneath, let seek natural size userIterateChildren(nodep, WidthVP(SELF, BOTH).p()); } - virtual void visit(AstText* nodep) override { + void visit(AstText* nodep) override { // Only used in CStmts which don't care.... } // DTYPES - virtual void visit(AstNodeArrayDType* nodep) override { + void visit(AstNodeArrayDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed if (nodep->subDTypep() == nodep->basicp()) { // Innermost dimension @@ -1537,7 +1533,7 @@ private: } UINFO(4, "dtWidthed " << nodep << endl); } - virtual void visit(AstAssocArrayDType* nodep) override { + void visit(AstAssocArrayDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed // Iterate into subDTypep() to resolve that type and update pointer. nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); @@ -1545,7 +1541,7 @@ private: nodep->dtypep(nodep); // The array itself, not subDtype UINFO(4, "dtWidthed " << nodep << endl); } - virtual void visit(AstBracketArrayDType* nodep) override { + void visit(AstBracketArrayDType* nodep) override { // Type inserted only because parser didn't know elementsp() type // Resolve elementsp's type userIterateChildren(nodep, WidthVP(SELF, BOTH).p()); @@ -1574,14 +1570,14 @@ private: // visit VL_DO_DANGLING(userIterate(newp, nullptr), newp); } - virtual void visit(AstDynArrayDType* nodep) override { + void visit(AstDynArrayDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed // Iterate into subDTypep() to resolve that type and update pointer. nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); nodep->dtypep(nodep); // The array itself, not subDtype UINFO(4, "dtWidthed " << nodep << endl); } - virtual void visit(AstQueueDType* nodep) override { + void visit(AstQueueDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed // Iterate into subDTypep() to resolve that type and update pointer. nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); @@ -1591,12 +1587,12 @@ private: } UINFO(4, "dtWidthed " << nodep << endl); } - virtual void visit(AstVoidDType* nodep) override { + void visit(AstVoidDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed nodep->dtypep(nodep); UINFO(4, "dtWidthed " << nodep << endl); } - virtual void visit(AstUnsizedArrayDType* nodep) override { + void visit(AstUnsizedArrayDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed // Iterate into subDTypep() to resolve that type and update pointer. nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); @@ -1604,7 +1600,7 @@ private: nodep->dtypep(nodep); // The array itself, not subDtype UINFO(4, "dtWidthed " << nodep << endl); } - virtual void visit(AstWildcardArrayDType* nodep) override { + void visit(AstWildcardArrayDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed // Iterate into subDTypep() to resolve that type and update pointer. nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); @@ -1612,7 +1608,7 @@ private: nodep->dtypep(nodep); // The array itself, not subDtype UINFO(4, "dtWidthed " << nodep << endl); } - virtual void visit(AstBasicDType* nodep) override { + void visit(AstBasicDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed if (nodep->generic()) return; // Already perfect if (nodep->rangep()) { @@ -1635,7 +1631,7 @@ private: // dtype Instead for now doing this in V3WidthCommit UINFO(4, "dtWidthed " << nodep << endl); } - virtual void visit(AstConstDType* nodep) override { + void visit(AstConstDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed // Iterate into subDTypep() to resolve that type and update pointer. nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); @@ -1644,7 +1640,7 @@ private: nodep->widthFromSub(nodep->subDTypep()); UINFO(4, "dtWidthed " << nodep << endl); } - virtual void visit(AstRefDType* nodep) override { + void visit(AstRefDType* nodep) override { if (nodep->doingWidth()) { // Early exit if have circular parameter definition nodep->v3error("Typedef's type is circular: " << nodep->prettyName()); nodep->dtypeSetBit(); @@ -1682,7 +1678,7 @@ private: UINFO(4, "dtWidthed " << nodep << endl); nodep->doingWidth(false); } - virtual void visit(AstTypedef* nodep) override { + void visit(AstTypedef* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed if (auto* const refp = checkRefToTypedefRecurse(nodep, nodep)) { nodep->v3error("Typedef has self-reference: " << nodep->prettyNameQ() << '\n' @@ -1698,13 +1694,13 @@ private: nodep->dtypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); userIterateChildren(nodep, nullptr); } - virtual void visit(AstParamTypeDType* nodep) override { + void visit(AstParamTypeDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed nodep->dtypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); userIterateChildren(nodep, nullptr); nodep->widthFromSub(nodep->subDTypep()); } - virtual void visit(AstCastDynamic* nodep) override { + void visit(AstCastDynamic* nodep) override { nodep->dtypeChgWidthSigned(32, 1, VSigning::SIGNED); // Spec says integer return userIterateChildren(nodep, WidthVP(SELF, BOTH).p()); AstNodeDType* const toDtp = nodep->top()->dtypep()->skipRefToEnump(); @@ -1779,7 +1775,7 @@ private: VL_DO_DANGLING(pushDeletep(nodep), nodep); userIterate(newp, m_vup); } - virtual void visit(AstCastParse* nodep) override { + void visit(AstCastParse* nodep) override { // nodep->dtp could be data type, or a primary_constant // Don't iterate lhsp, will deal with that once convert the type V3Const::constifyParamsEdit(nodep->dtp()); // itemp may change @@ -1796,7 +1792,7 @@ private: nodep->replaceWith(nodep->lhsp()->unlinkFrBack()); } } - virtual void visit(AstCast* nodep) override { + void visit(AstCast* nodep) override { nodep->dtypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); if (m_vup->prelim()) { // if (debug()) nodep->dumpTree(cout, " CastPre: "); @@ -1883,7 +1879,7 @@ private: VL_DO_DANGLING(pushDeletep(nodep), nodep); } } - virtual void visit(AstCastSize* nodep) override { + void visit(AstCastSize* nodep) override { // IEEE: Signedness of result is same as self-determined signedness // However, the result is same as BITSEL, so we do not sign extend the LHS UASSERT_OBJ(VN_IS(nodep->rhsp(), Const), nodep, "Unsupported: Non-const cast of size"); @@ -1943,7 +1939,7 @@ private: VL_DANGLING(underp); } } - virtual void visit(AstVar* nodep) override { + void visit(AstVar* nodep) override { // if (debug()) nodep->dumpTree(cout, " InitPre: "); // Must have deterministic constant width // We can't skip this step when width()!=0, as creating a AstVar @@ -2055,7 +2051,7 @@ private: nodep->didWidth(true); nodep->doingWidth(false); } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { if (nodep->didWidth()) return; if (!nodep->varp()) { if (m_paramsOnly && VN_IS(nodep, VarXRef)) { @@ -2092,7 +2088,7 @@ private: nodep->didWidth(true); } - virtual void visit(AstEnumDType* nodep) override { + void visit(AstEnumDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed UINFO(5, " ENUMDTYPE " << nodep << endl); nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); @@ -2156,7 +2152,7 @@ private: num.opAdd(one, constp->num()); } } - virtual void visit(AstEnumItem* nodep) override { + void visit(AstEnumItem* nodep) override { UINFO(5, " ENUMITEM " << nodep << endl); AstNodeDType* const vdtypep = m_vup->dtypep(); UASSERT_OBJ(vdtypep, nodep, "ENUMITEM not under ENUM"); @@ -2170,7 +2166,7 @@ private: EXTEND_EXP); } } - virtual void visit(AstEnumItemRef* nodep) override { + void visit(AstEnumItemRef* nodep) override { if (!nodep->itemp()->didWidth()) { // We need to do the whole enum en-mass AstNode* enump = nodep->itemp(); @@ -2183,7 +2179,7 @@ private: } nodep->dtypeFrom(nodep->itemp()); } - virtual void visit(AstConsAssoc* nodep) override { + void visit(AstConsAssoc* nodep) override { // Type computed when constructed here auto* const vdtypep = VN_AS(m_vup->dtypep()->skipRefp(), AssocArrayDType); UASSERT_OBJ(vdtypep, nodep, "ConsAssoc requires assoc upper parent data type"); @@ -2195,7 +2191,7 @@ private: } } } - virtual void visit(AstSetAssoc* nodep) override { + void visit(AstSetAssoc* nodep) override { // Type computed when constructed here auto* const vdtypep = VN_AS(m_vup->dtypep()->skipRefp(), AssocArrayDType); UASSERT_OBJ(vdtypep, nodep, "SetsAssoc requires assoc upper parent data type"); @@ -2208,7 +2204,7 @@ private: EXTEND_EXP); } } - virtual void visit(AstConsWildcard* nodep) override { + void visit(AstConsWildcard* nodep) override { // Type computed when constructed here auto* const vdtypep = VN_AS(m_vup->dtypep()->skipRefp(), WildcardArrayDType); UASSERT_OBJ(vdtypep, nodep, "ConsWildcard requires wildcard upper parent data type"); @@ -2220,7 +2216,7 @@ private: } } } - virtual void visit(AstSetWildcard* nodep) override { + void visit(AstSetWildcard* nodep) override { // Type computed when constructed here auto* const vdtypep = VN_AS(m_vup->dtypep()->skipRefp(), WildcardArrayDType); UASSERT_OBJ(vdtypep, nodep, "SetWildcard requires wildcard upper parent data type"); @@ -2233,7 +2229,7 @@ private: EXTEND_EXP); } } - virtual void visit(AstConsDynArray* nodep) override { + void visit(AstConsDynArray* nodep) override { // Type computed when constructed here AstDynArrayDType* const vdtypep = VN_AS(m_vup->dtypep()->skipRefp(), DynArrayDType); UASSERT_OBJ(vdtypep, nodep, "ConsDynArray requires queue upper parent data type"); @@ -2265,7 +2261,7 @@ private: nodep->dtypeFrom(vdtypep); } } - virtual void visit(AstConsQueue* nodep) override { + void visit(AstConsQueue* nodep) override { // Type computed when constructed here AstQueueDType* const vdtypep = VN_AS(m_vup->dtypep()->skipRefp(), QueueDType); UASSERT_OBJ(vdtypep, nodep, "ConsQueue requires queue upper parent data type"); @@ -2297,10 +2293,10 @@ private: nodep->dtypeFrom(vdtypep); } } - virtual void visit(AstInitItem* nodep) override { // + void visit(AstInitItem* nodep) override { // userIterateChildren(nodep, m_vup); } - virtual void visit(AstInitArray* nodep) override { + void visit(AstInitArray* nodep) override { // InitArray has type of the array; children are array values if (m_vup->prelim()) { // First stage evaluation AstNodeDType* const vdtypep = m_vup->dtypeNullp(); @@ -2315,7 +2311,7 @@ private: } } } - virtual void visit(AstInside* nodep) override { + void visit(AstInside* nodep) override { userIterateAndNext(nodep->exprp(), WidthVP(CONTEXT, PRELIM).p()); for (AstNode *nextip, *itemp = nodep->itemsp(); itemp; itemp = nextip) { nextip = itemp->nextp(); // Prelim may cause the node to get replaced @@ -2374,14 +2370,14 @@ private: nodep->replaceWith(newp); VL_DO_DANGLING(pushDeletep(nodep), nodep); } - virtual void visit(AstInsideRange* nodep) override { + void visit(AstInsideRange* nodep) override { // Just do each side; AstInside will rip these nodes out later userIterateAndNext(nodep->lhsp(), m_vup); userIterateAndNext(nodep->rhsp(), m_vup); nodep->dtypeFrom(nodep->lhsp()); } - virtual void visit(AstIfaceRefDType* nodep) override { + void visit(AstIfaceRefDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed UINFO(5, " IFACEREF " << nodep << endl); userIterateChildren(nodep, m_vup); @@ -2389,7 +2385,7 @@ private: nodep->widthForce(1, 1); // Not really relevant UINFO(4, "dtWidthed " << nodep << endl); } - virtual void visit(AstNodeUOrStructDType* nodep) override { + void visit(AstNodeUOrStructDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed UINFO(5, " NODECLASS " << nodep << endl); // if (debug() >= 9) nodep->dumpTree("-class-in--"); @@ -2424,7 +2420,7 @@ private: nodep->widthForce(width, width); // Signing stays as-is, as parsed from declaration // if (debug() >= 9) nodep->dumpTree("-class-out-"); } - virtual void visit(AstClass* nodep) override { + void visit(AstClass* nodep) override { if (nodep->didWidthAndSet()) return; // Must do extends first, as we may in functions under this class // start following a tree of extends that takes us to other classes @@ -2432,37 +2428,37 @@ private: userIterateChildren(nodep, nullptr); // First size all members nodep->repairCache(); } - virtual void visit(AstClassRefDType* nodep) override { + void visit(AstClassRefDType* nodep) override { if (nodep->didWidthAndSet()) return; // TODO this maybe eventually required to properly resolve members, // though causes problems with t_class_forward.v, so for now avoided // userIterateChildren(nodep->classp(), nullptr); } - virtual void visit(AstClassOrPackageRef* nodep) override { + void visit(AstClassOrPackageRef* nodep) override { if (nodep->didWidthAndSet()) return; userIterateChildren(nodep, nullptr); } - virtual void visit(AstDot* nodep) override { + void visit(AstDot* nodep) override { // We can only reach this from constify called during V3Param (so before linkDotParam) // ... #(Cls#(...)::...) ... // ^^~~~ this is our DOT nodep->v3warn(E_UNSUPPORTED, "dotted expressions in parameters\n" << nodep->warnMore() << "... Suggest use a typedef"); } - virtual void visit(AstClassExtends* nodep) override { + void visit(AstClassExtends* nodep) override { if (nodep->didWidthAndSet()) return; if (VN_IS(nodep->childDTypep(), ClassRefDType)) { nodep->dtypep(iterateEditMoveDTypep(nodep, nodep->childDTypep())); } } - virtual void visit(AstMemberDType* nodep) override { + void visit(AstMemberDType* nodep) override { if (nodep->didWidthAndSet()) return; // This node is a dtype & not both PRELIMed+FINALed // Iterate into subDTypep() to resolve that type and update pointer. nodep->refDTypep(iterateEditMoveDTypep(nodep, nodep->subDTypep())); nodep->dtypep(nodep); // The member itself, not subDtype nodep->widthFromSub(nodep->subDTypep()); } - virtual void visit(AstMemberSel* nodep) override { + void visit(AstMemberSel* nodep) override { UINFO(5, " MEMBERSEL " << nodep << endl); if (debug() >= 9) nodep->dumpTree("-mbs-in: "); userIterateChildren(nodep, WidthVP(SELF, BOTH).p()); @@ -2565,12 +2561,12 @@ private: return false; } - virtual void visit(AstCMethodHard* nodep) override { + void visit(AstCMethodHard* nodep) override { // Never created before V3Width, so no need to redo it UASSERT_OBJ(nodep->dtypep(), nodep, "CMETHODCALLs should have already been sized"); } - virtual void visit(AstMethodCall* nodep) override { + void visit(AstMethodCall* nodep) override { UINFO(5, " METHODCALL " << nodep << endl); if (nodep->didWidth()) return; if (debug() >= 9) nodep->dumpTree("-mts-in: "); @@ -3418,7 +3414,7 @@ private: } } - virtual void visit(AstNew* nodep) override { + void visit(AstNew* nodep) override { if (nodep->didWidth()) return; AstClassRefDType* const refp = m_vup ? VN_CAST(m_vup->dtypeNullSkipRefp(), ClassRefDType) : nullptr; @@ -3444,7 +3440,7 @@ private: userIterate(nodep->taskp(), nullptr); processFTaskRefArgs(nodep); } - virtual void visit(AstNewCopy* nodep) override { + void visit(AstNewCopy* nodep) override { if (nodep->didWidthAndSet()) return; AstClassRefDType* const refp = VN_CAST(m_vup->dtypeNullSkipRefp(), ClassRefDType); if (!refp) { // e.g. int a = new; @@ -3459,7 +3455,7 @@ private: << nodep->rhsp()->dtypep()->prettyTypeName() << "'"); } } - virtual void visit(AstNewDynamic* nodep) override { + void visit(AstNewDynamic* nodep) override { if (nodep->didWidthAndSet()) return; AstDynArrayDType* const adtypep = VN_CAST(m_vup->dtypeNullSkipRefp(), DynArrayDType); if (!adtypep) { // e.g. int a = new; @@ -3483,7 +3479,7 @@ private: } } - virtual void visit(AstPattern* nodep) override { + void visit(AstPattern* nodep) override { if (nodep->didWidthAndSet()) return; UINFO(9, "PATTERN " << nodep << endl); if (nodep->childDTypep()) { // data_type '{ pattern } @@ -3919,7 +3915,7 @@ private: return valuep; } - virtual void visit(AstPatMember* nodep) override { + void visit(AstPatMember* nodep) override { AstNodeDType* const vdtypep = m_vup->dtypeNullp(); UASSERT_OBJ(vdtypep, nodep, "Pattern member type not assigned by AstPattern visitor"); nodep->dtypep(vdtypep); @@ -3953,7 +3949,7 @@ private: return times; } - virtual void visit(AstPropClocked* nodep) override { + void visit(AstPropClocked* nodep) override { if (m_vup->prelim()) { // First stage evaluation iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); userIterateAndNext(nodep->sensesp(), nullptr); @@ -3968,7 +3964,7 @@ private: //-------------------- // Top levels - virtual void visit(AstNodeCase* nodep) override { + void visit(AstNodeCase* nodep) override { // IEEE-2012 12.5: // Width: MAX(expr, all items) // Signed: Only if expr, and all items signed @@ -4014,7 +4010,7 @@ private: } } } - virtual void visit(AstNodeFor* nodep) override { + void visit(AstNodeFor* nodep) override { assertAtStatement(nodep); userIterateAndNext(nodep->initsp(), nullptr); iterateCheckBool(nodep, "For Test Condition", nodep->condp(), @@ -4022,12 +4018,12 @@ private: if (!VN_IS(nodep, GenFor)) userIterateAndNext(nodep->bodysp(), nullptr); userIterateAndNext(nodep->incsp(), nullptr); } - virtual void visit(AstRepeat* nodep) override { + void visit(AstRepeat* nodep) override { assertAtStatement(nodep); userIterateAndNext(nodep->countp(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->bodysp(), nullptr); } - virtual void visit(AstWhile* nodep) override { + void visit(AstWhile* nodep) override { assertAtStatement(nodep); userIterateAndNext(nodep->precondsp(), nullptr); iterateCheckBool(nodep, "For Test Condition", nodep->condp(), @@ -4035,7 +4031,7 @@ private: userIterateAndNext(nodep->bodysp(), nullptr); userIterateAndNext(nodep->incsp(), nullptr); } - virtual void visit(AstNodeIf* nodep) override { + void visit(AstNodeIf* nodep) override { assertAtStatement(nodep); // if (debug()) nodep->dumpTree(cout, " IfPre: "); if (!VN_IS(nodep, GenIf)) { // for m_paramsOnly @@ -4045,13 +4041,13 @@ private: iterateCheckBool(nodep, "If", nodep->condp(), BOTH); // it's like an if() condition. // if (debug()) nodep->dumpTree(cout, " IfOut: "); } - virtual void visit(AstExprStmt* nodep) override { + void visit(AstExprStmt* nodep) override { userIterateAndNext(nodep->stmtsp(), nullptr); // expected result is same as parent's expected result userIterateAndNext(nodep->resultp(), m_vup); nodep->dtypeFrom(nodep->resultp()); } - virtual void visit(AstForeach* nodep) override { + void visit(AstForeach* nodep) override { const AstSelLoopVars* const loopsp = VN_CAST(nodep->arrayp(), SelLoopVars); UASSERT_OBJ(loopsp, nodep, "No loop variables under foreach"); // if (debug()) nodep->dumpTree(cout, "-foreach-old: "); @@ -4214,7 +4210,7 @@ private: return newp; } - virtual void visit(AstNodeAssign* nodep) override { + void visit(AstNodeAssign* nodep) override { // IEEE-2012 10.7, 11.8.2, 11.8.3, 11.5: (Careful of 11.8.1 which is // only one step; final dtype depends on assign LHS.) // Determine RHS type width and signing @@ -4288,13 +4284,13 @@ private: } } - virtual void visit(AstRelease* nodep) override { + void visit(AstRelease* nodep) override { userIterateAndNext(nodep->lhsp(), WidthVP(SELF, BOTH).p()); UASSERT_OBJ(nodep->lhsp()->dtypep(), nodep, "How can LValue be untyped?"); UASSERT_OBJ(nodep->lhsp()->dtypep()->widthSized(), nodep, "How can LValue be unsized?"); } - virtual void visit(AstSFormatF* nodep) override { + void visit(AstSFormatF* nodep) override { // Excludes NodeDisplay, see below if (m_vup && !m_vup->prelim()) return; // Can be called as statement or function // Just let all arguments seek their natural sizes @@ -4427,13 +4423,13 @@ private: nodep->text(newFormat); UINFO(9, " Display out " << nodep->text() << endl); } - virtual void visit(AstDisplay* nodep) override { + void visit(AstDisplay* nodep) override { assertAtStatement(nodep); if (nodep->filep()) iterateCheckFileDesc(nodep, nodep->filep(), BOTH); // Just let all arguments seek their natural sizes userIterateChildren(nodep, WidthVP(SELF, BOTH).p()); } - virtual void visit(AstElabDisplay* nodep) override { + void visit(AstElabDisplay* nodep) override { assertAtStatement(nodep); // Just let all arguments seek their natural sizes userIterateChildren(nodep, WidthVP(SELF, BOTH).p()); @@ -4451,28 +4447,28 @@ private: VL_DO_DANGLING(nodep->unlinkFrBack()->deleteTree(), nodep); } } - virtual void visit(AstDumpCtl* nodep) override { + void visit(AstDumpCtl* nodep) override { assertAtStatement(nodep); // Just let all arguments seek their natural sizes userIterateChildren(nodep, WidthVP(SELF, BOTH).p()); } - virtual void visit(AstFOpen* nodep) override { + void visit(AstFOpen* nodep) override { // Although a system function in IEEE, here a statement which sets the file pointer (MCD) assertAtStatement(nodep); iterateCheckFileDesc(nodep, nodep->filep(), BOTH); userIterateAndNext(nodep->filenamep(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->modep(), WidthVP(SELF, BOTH).p()); } - virtual void visit(AstFOpenMcd* nodep) override { + void visit(AstFOpenMcd* nodep) override { assertAtStatement(nodep); iterateCheckFileDesc(nodep, nodep->filep(), BOTH); userIterateAndNext(nodep->filenamep(), WidthVP(SELF, BOTH).p()); } - virtual void visit(AstFClose* nodep) override { + void visit(AstFClose* nodep) override { assertAtStatement(nodep); iterateCheckFileDesc(nodep, nodep->filep(), BOTH); } - virtual void visit(AstFError* nodep) override { + void visit(AstFError* nodep) override { if (m_vup->prelim()) { iterateCheckFileDesc(nodep, nodep->filep(), BOTH); // We only support string types, not packed array @@ -4480,51 +4476,51 @@ private: nodep->dtypeSetLogicUnsized(32, 1, VSigning::SIGNED); // Spec says integer return } } - virtual void visit(AstFEof* nodep) override { + void visit(AstFEof* nodep) override { if (m_vup->prelim()) { iterateCheckFileDesc(nodep, nodep->filep(), BOTH); nodep->dtypeSetLogicUnsized(32, 1, VSigning::SIGNED); // Spec says integer return } } - virtual void visit(AstFFlush* nodep) override { + void visit(AstFFlush* nodep) override { assertAtStatement(nodep); if (nodep->filep()) iterateCheckFileDesc(nodep, nodep->filep(), BOTH); } - virtual void visit(AstFRewind* nodep) override { + void visit(AstFRewind* nodep) override { iterateCheckFileDesc(nodep, nodep->filep(), BOTH); nodep->dtypeSetLogicUnsized(32, 1, VSigning::SIGNED); // Spec says integer return } - virtual void visit(AstFTell* nodep) override { + void visit(AstFTell* nodep) override { iterateCheckFileDesc(nodep, nodep->filep(), BOTH); nodep->dtypeSetLogicUnsized(32, 1, VSigning::SIGNED); // Spec says integer return } - virtual void visit(AstFSeek* nodep) override { + void visit(AstFSeek* nodep) override { iterateCheckFileDesc(nodep, nodep->filep(), BOTH); iterateCheckSigned32(nodep, "$fseek offset", nodep->offset(), BOTH); iterateCheckSigned32(nodep, "$fseek operation", nodep->operation(), BOTH); nodep->dtypeSetLogicUnsized(32, 1, VSigning::SIGNED); // Spec says integer return } - virtual void visit(AstFGetC* nodep) override { + void visit(AstFGetC* nodep) override { if (m_vup->prelim()) { iterateCheckFileDesc(nodep, nodep->filep(), BOTH); nodep->dtypeSetLogicUnsized(32, 8, VSigning::SIGNED); // Spec says integer return } } - virtual void visit(AstFGetS* nodep) override { + void visit(AstFGetS* nodep) override { if (m_vup->prelim()) { nodep->dtypeSetSigned32(); // Spec says integer return iterateCheckFileDesc(nodep, nodep->filep(), BOTH); userIterateAndNext(nodep->strgp(), WidthVP(SELF, BOTH).p()); } } - virtual void visit(AstFUngetC* nodep) override { + void visit(AstFUngetC* nodep) override { if (m_vup->prelim()) { iterateCheckFileDesc(nodep, nodep->filep(), BOTH); iterateCheckSigned32(nodep, "$fungetc character", nodep->charp(), BOTH); nodep->dtypeSetLogicUnsized(32, 8, VSigning::SIGNED); // Spec says integer return } } - virtual void visit(AstFRead* nodep) override { + void visit(AstFRead* nodep) override { if (m_vup->prelim()) { nodep->dtypeSetSigned32(); // Spec says integer return userIterateAndNext(nodep->memp(), WidthVP(SELF, BOTH).p()); @@ -4537,38 +4533,38 @@ private: } } } - virtual void visit(AstFScanF* nodep) override { + void visit(AstFScanF* nodep) override { if (m_vup->prelim()) { nodep->dtypeSetSigned32(); // Spec says integer return iterateCheckFileDesc(nodep, nodep->filep(), BOTH); userIterateAndNext(nodep->exprsp(), WidthVP(SELF, BOTH).p()); } } - virtual void visit(AstSScanF* nodep) override { + void visit(AstSScanF* nodep) override { if (m_vup->prelim()) { nodep->dtypeSetSigned32(); // Spec says integer return userIterateAndNext(nodep->fromp(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->exprsp(), WidthVP(SELF, BOTH).p()); } } - virtual void visit(AstSysIgnore* nodep) override { + void visit(AstSysIgnore* nodep) override { userIterateAndNext(nodep->exprsp(), WidthVP(SELF, BOTH).p()); } - virtual void visit(AstSystemF* nodep) override { + void visit(AstSystemF* nodep) override { if (m_vup->prelim()) { userIterateAndNext(nodep->lhsp(), WidthVP(SELF, BOTH).p()); nodep->dtypeSetSigned32(); // Spec says integer return } } - virtual void visit(AstSysFuncAsTask* nodep) override { + void visit(AstSysFuncAsTask* nodep) override { assertAtStatement(nodep); userIterateAndNext(nodep->lhsp(), WidthVP(SELF, BOTH).p()); } - virtual void visit(AstSystemT* nodep) override { + void visit(AstSystemT* nodep) override { assertAtStatement(nodep); userIterateAndNext(nodep->lhsp(), WidthVP(SELF, BOTH).p()); } - virtual void visit(AstNodeReadWriteMem* nodep) override { + void visit(AstNodeReadWriteMem* nodep) override { assertAtStatement(nodep); userIterateAndNext(nodep->filenamep(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->memp(), WidthVP(SELF, BOTH).p()); @@ -4600,53 +4596,53 @@ private: userIterateAndNext(nodep->lsbp(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->msbp(), WidthVP(SELF, BOTH).p()); } - virtual void visit(AstTestPlusArgs* nodep) override { + void visit(AstTestPlusArgs* nodep) override { if (m_vup->prelim()) { userIterateAndNext(nodep->searchp(), WidthVP{SELF, BOTH}.p()); nodep->dtypeChgWidthSigned(32, 1, VSigning::SIGNED); // Spec says integer return } } - virtual void visit(AstValuePlusArgs* nodep) override { + void visit(AstValuePlusArgs* nodep) override { if (m_vup->prelim()) { userIterateAndNext(nodep->searchp(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->outp(), WidthVP(SELF, BOTH).p()); nodep->dtypeChgWidthSigned(32, 1, VSigning::SIGNED); // Spec says integer return } } - virtual void visit(AstTimeFormat* nodep) override { + void visit(AstTimeFormat* nodep) override { assertAtStatement(nodep); iterateCheckSigned32(nodep, "units", nodep->unitsp(), BOTH); iterateCheckSigned32(nodep, "precision", nodep->precisionp(), BOTH); iterateCheckString(nodep, "suffix", nodep->suffixp(), BOTH); iterateCheckSigned32(nodep, "width", nodep->widthp(), BOTH); } - virtual void visit(AstUCStmt* nodep) override { + void visit(AstUCStmt* nodep) override { // Just let all arguments seek their natural sizes assertAtStatement(nodep); userIterateChildren(nodep, WidthVP(SELF, BOTH).p()); } - virtual void visit(AstAssert* nodep) override { + void visit(AstAssert* nodep) override { assertAtStatement(nodep); iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); // it's like an if() condition. userIterateAndNext(nodep->passsp(), nullptr); userIterateAndNext(nodep->failsp(), nullptr); } - virtual void visit(AstAssertIntrinsic* nodep) override { + void visit(AstAssertIntrinsic* nodep) override { assertAtStatement(nodep); iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); // it's like an if() condition. userIterateAndNext(nodep->passsp(), nullptr); userIterateAndNext(nodep->failsp(), nullptr); } - virtual void visit(AstCover* nodep) override { + void visit(AstCover* nodep) override { assertAtStatement(nodep); iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); // it's like an if() condition. userIterateAndNext(nodep->passsp(), nullptr); } - virtual void visit(AstRestrict* nodep) override { + void visit(AstRestrict* nodep) override { assertAtStatement(nodep); iterateCheckBool(nodep, "Property", nodep->propp(), BOTH); // it's like an if() condition. } - virtual void visit(AstPin* nodep) override { + void visit(AstPin* nodep) override { // if (debug()) nodep->dumpTree(cout, "- PinPre: "); // TOP LEVEL NODE if (nodep->modVarp() && nodep->modVarp()->isGParam()) { @@ -4771,7 +4767,7 @@ private: } // if (debug()) nodep->dumpTree(cout, "- PinOut: "); } - virtual void visit(AstCell* nodep) override { + void visit(AstCell* nodep) override { VL_RESTORER(m_cellp); m_cellp = nodep; if (!m_paramsOnly) { @@ -4788,7 +4784,7 @@ private: } userIterateAndNext(nodep->paramsp(), nullptr); } - virtual void visit(AstGatePin* nodep) override { + void visit(AstGatePin* nodep) override { if (m_vup->prelim()) { userIterateAndNext(nodep->rangep(), WidthVP(SELF, BOTH).p()); userIterateAndNext(nodep->exprp(), WidthVP(CONTEXT, PRELIM).p()); @@ -4812,7 +4808,7 @@ private: VL_DO_DANGLING(pushDeletep(nodep), nodep); } } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { // Grab width from the output variable (if it's a function) if (nodep->didWidth()) return; if (nodep->doingWidth()) { @@ -4854,7 +4850,7 @@ private: // func } } - virtual void visit(AstReturn* nodep) override { + void visit(AstReturn* nodep) override { // IEEE: Assignment-like context assertAtStatement(nodep); if (!m_funcp) { @@ -4872,7 +4868,7 @@ private: } } - virtual void visit(AstFuncRef* nodep) override { + void visit(AstFuncRef* nodep) override { visit(static_cast(nodep)); nodep->dtypeFrom(nodep->taskp()); // if (debug()) nodep->dumpTree(cout, " FuncOut: "); @@ -5042,7 +5038,7 @@ private: } } } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { // For arguments, is assignment-like context; see IEEE rules in AstNodeAssign // Function hasn't been widthed, so make it so. UINFO(5, " FTASKREF " << nodep << endl); @@ -5053,13 +5049,13 @@ private: processFTaskRefArgs(nodep); nodep->didWidth(true); } - virtual void visit(AstNodeProcedure* nodep) override { + void visit(AstNodeProcedure* nodep) override { assertAtStatement(nodep); m_procedurep = nodep; userIterateChildren(nodep, nullptr); m_procedurep = nullptr; } - virtual void visit(AstWith* nodep) override { + void visit(AstWith* nodep) override { // Should otherwise be underneath a method call AstNodeDType* const vdtypep = m_vup->dtypeNullSkipRefp(); { @@ -5077,7 +5073,7 @@ private: nodep->dtypep()); } } - virtual void visit(AstLambdaArgRef* nodep) override { + void visit(AstLambdaArgRef* nodep) override { UASSERT_OBJ(m_withp, nodep, "LambdaArgRef not underneath 'with' lambda"); if (nodep->index()) { nodep->dtypeFrom(m_withp->indexArgRefp()); @@ -5085,21 +5081,21 @@ private: nodep->dtypeFrom(m_withp->valueArgRefp()); } } - virtual void visit(AstNetlist* nodep) override { + void visit(AstNetlist* nodep) override { // Iterate modules backwards, in bottom-up order. That's faster userIterateChildrenBackwards(nodep, nullptr); } //-------------------- // Default - virtual void visit(AstNodeMath* nodep) override { + void visit(AstNodeMath* nodep) override { if (!nodep->didWidth()) { nodep->v3fatalSrc( "Visit function missing? Widthed function missing for math node: " << nodep); } userIterateChildren(nodep, nullptr); } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { // Default: Just iterate UASSERT_OBJ(!m_vup, nodep, "Visit function missing? Widthed expectation for this node: " << nodep); @@ -5121,7 +5117,7 @@ private: iterateCheck(nodep, "LHS", nodep->lhsp(), SELF, FINAL, subDTypep, EXTEND_EXP); } } - virtual void visit(AstIToRD* nodep) override { + void visit(AstIToRD* nodep) override { // Real: Output real // LHS presumed self-determined, then coerced to real if (m_vup->prelim()) { // First stage evaluation @@ -5135,7 +5131,7 @@ private: } } } - virtual void visit(AstISToRD* nodep) override { + void visit(AstISToRD* nodep) override { // Real: Output real // LHS presumed self-determined, then coerced to real if (m_vup->prelim()) { // First stage evaluation @@ -6726,7 +6722,7 @@ public: AstNode* mainAcceptEdit(AstNode* nodep) { return userIterateSubtreeReturnEdits(nodep, WidthVP(SELF, BOTH).p()); } - virtual ~WidthVisitor() override = default; + ~WidthVisitor() override = default; }; //###################################################################### diff --git a/src/V3WidthCommit.h b/src/V3WidthCommit.h index 5b784387d..fb883a256 100644 --- a/src/V3WidthCommit.h +++ b/src/V3WidthCommit.h @@ -45,18 +45,18 @@ private: } // VISITORS - virtual void visit(AstSigned* nodep) override { + void visit(AstSigned* nodep) override { VL_DO_DANGLING(replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()), nodep); } - virtual void visit(AstUnsigned* nodep) override { + void visit(AstUnsigned* nodep) override { VL_DO_DANGLING(replaceWithSignedVersion(nodep, nodep->lhsp()->unlinkFrBack()), nodep); } - virtual void visit(AstNode* nodep) override { iterateChildren(nodep); } + void visit(AstNode* nodep) override { iterateChildren(nodep); } public: // CONSTRUCTORS WidthRemoveVisitor() = default; - virtual ~WidthRemoveVisitor() override = default; + ~WidthRemoveVisitor() override = default; AstNode* mainAcceptEdit(AstNode* nodep) { return iterateSubtreeReturnEdits(nodep); } }; @@ -151,7 +151,7 @@ private: } // VISITORS - virtual void visit(AstNodeModule* nodep) override { + void visit(AstNodeModule* nodep) override { VL_RESTORER(m_modp); { m_modp = nodep; @@ -159,7 +159,7 @@ private: editDType(nodep); } } - virtual void visit(AstConst* nodep) override { + void visit(AstConst* nodep) override { UASSERT_OBJ(nodep->dtypep(), nodep, "No dtype"); iterate(nodep->dtypep()); // Do datatype first if (AstConst* const newp = newIfConstCommitSize(nodep)) { @@ -172,15 +172,15 @@ private: } editDType(nodep); } - virtual void visit(AstNodeDType* nodep) override { // + void visit(AstNodeDType* nodep) override { // visitIterateNodeDType(nodep); } - virtual void visit(AstNodeUOrStructDType* nodep) override { + void visit(AstNodeUOrStructDType* nodep) override { if (nodep->user1SetOnce()) return; // Process once visitIterateNodeDType(nodep); nodep->clearCache(); } - virtual void visit(AstParamTypeDType* nodep) override { + void visit(AstParamTypeDType* nodep) override { if (nodep->user1SetOnce()) return; // Process once visitIterateNodeDType(nodep); // Move to type table as all dtype pointers must resolve there @@ -199,7 +199,7 @@ private: nodep->virtRefDTypep(editOneDType(nodep->virtRefDTypep())); nodep->virtRefDType2p(editOneDType(nodep->virtRefDType2p())); } - virtual void visit(AstNodeFTask* nodep) override { + void visit(AstNodeFTask* nodep) override { iterateChildren(nodep); editDType(nodep); if (nodep->classMethod() && nodep->pureVirtual() && VN_IS(m_modp, Class) @@ -208,28 +208,28 @@ private: "Illegal to have 'pure virtual' in non-virtual class (IEEE 1800-2017 8.21)"); } } - virtual void visit(AstNodeVarRef* nodep) override { + void visit(AstNodeVarRef* nodep) override { iterateChildren(nodep); editDType(nodep); classEncapCheck(nodep, nodep->varp(), VN_CAST(nodep->classOrPackagep(), Class)); } - virtual void visit(AstNodeFTaskRef* nodep) override { + void visit(AstNodeFTaskRef* nodep) override { iterateChildren(nodep); editDType(nodep); classEncapCheck(nodep, nodep->taskp(), VN_CAST(nodep->classOrPackagep(), Class)); } - virtual void visit(AstMemberSel* nodep) override { + void visit(AstMemberSel* nodep) override { iterateChildren(nodep); editDType(nodep); if (auto* const classrefp = VN_CAST(nodep->fromp()->dtypep(), ClassRefDType)) { classEncapCheck(nodep, nodep->varp(), classrefp->classp()); } // else might be struct, etc } - virtual void visit(AstNodePreSel* nodep) override { // LCOV_EXCL_LINE + void visit(AstNodePreSel* nodep) override { // LCOV_EXCL_LINE // This check could go anywhere after V3Param nodep->v3fatalSrc("Presels should have been removed before this point"); } - virtual void visit(AstNode* nodep) override { + void visit(AstNode* nodep) override { iterateChildren(nodep); editDType(nodep); } @@ -243,7 +243,7 @@ public: // Don't want to repairCache, as all needed nodes have been added back in // a repair would prevent dead nodes from being detected } - virtual ~WidthCommitVisitor() override = default; + ~WidthCommitVisitor() override = default; }; //###################################################################### diff --git a/src/V3WidthSel.cpp b/src/V3WidthSel.cpp index 19392df58..222f69c5b 100644 --- a/src/V3WidthSel.cpp +++ b/src/V3WidthSel.cpp @@ -202,7 +202,7 @@ private: // VISITORS // If adding new visitors, ensure V3Width's visit(TYPE) calls into here - virtual void visit(AstSelBit* nodep) override { + void visit(AstSelBit* nodep) override { // Select of a non-width specified part of an array, i.e. "array[2]" // This select style has a lsb and msb (no user specified width) UINFO(6, "SELBIT " << nodep << endl); @@ -330,7 +330,7 @@ private: } if (!rhsp->backp()) VL_DO_DANGLING(pushDeletep(rhsp), rhsp); } - virtual void visit(AstSelExtract* nodep) override { + void visit(AstSelExtract* nodep) override { // Select of a range specified part of an array, i.e. "array[2:3]" // SELEXTRACT(from,msb,lsb) -> SEL(from, lsb, 1+msb-lsb) // This select style has a (msb or lsb) and width @@ -584,13 +584,13 @@ private: if (!rhsp->backp()) VL_DO_DANGLING(pushDeletep(rhsp), rhsp); if (!widthp->backp()) VL_DO_DANGLING(pushDeletep(widthp), widthp); } - virtual void visit(AstSelPlus* nodep) override { replaceSelPlusMinus(nodep); } - virtual void visit(AstSelMinus* nodep) override { replaceSelPlusMinus(nodep); } + void visit(AstSelPlus* nodep) override { replaceSelPlusMinus(nodep); } + void visit(AstSelMinus* nodep) override { replaceSelPlusMinus(nodep); } // If adding new visitors, ensure V3Width's visit(TYPE) calls into here //-------------------- // Default - virtual void visit(AstNode* nodep) override { // LCOV_EXCL_LINE + void visit(AstNode* nodep) override { // LCOV_EXCL_LINE // See notes above; we never iterate nodep->v3fatalSrc("Shouldn't iterate in V3WidthSel"); } @@ -598,7 +598,7 @@ private: public: // CONSTRUCTORS WidthSelVisitor() = default; - virtual ~WidthSelVisitor() override = default; + ~WidthSelVisitor() override = default; AstNode* mainAcceptEdit(AstNode* nodep) { return iterateSubtreeReturnEdits(nodep); } }; diff --git a/src/astgen b/src/astgen index 02d8d06d6..98d0750fe 100755 --- a/src/astgen +++ b/src/astgen @@ -468,7 +468,7 @@ class Cpt: if len(out_for_type_sc) > 0: # Short-circuited types self.print( " // Generated by astgen with short-circuiting\n" + - " virtual void visit(Ast" + node.name + + " void visit(Ast" + node.name + "* nodep) override {\n" + " iterateAndNextNull(nodep->lhsp());\n" + "".join(out_for_type_sc)) @@ -481,10 +481,12 @@ class Cpt: elif len(out_for_type) > 0: # Other types with something to print skip = node.name in self.tree_skip_visit gen = "Gen" if skip else "" + virtual = "virtual " if skip else "" override = "" if skip else " override" self.print( - " // Generated by astgen\n" + " virtual void visit" + - gen + "(Ast" + node.name + "* nodep)" + override + " {\n" + + " // Generated by astgen\n" + " " + virtual + + "void visit" + gen + "(Ast" + node.name + "* nodep)" + + override + " {\n" + ("" if skip else " iterateChildren(nodep);\n") + ''.join(out_for_type) + " }\n") @@ -751,8 +753,8 @@ def write_macros(filename): if node.isLeaf: emitBlock('''\ - virtual void accept(VNVisitor& v) override {{ v.visit(this); }} - virtual AstNode* clone() override {{ return new Ast{t}(*this); }} + void accept(VNVisitor& v) override {{ v.visit(this); }} + AstNode* clone() override {{ return new Ast{t}(*this); }} ''', t=node.name) diff --git a/test_regress/t/t_dist_cppstyle.pl b/test_regress/t/t_dist_cppstyle.pl new file mode 100755 index 000000000..a54fef2dd --- /dev/null +++ b/test_regress/t/t_dist_cppstyle.pl @@ -0,0 +1,66 @@ +#!/usr/bin/env perl +if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; } +# DESCRIPTION: Verilator: Primitive C++ style checker +# +# Copyright 2022 by Geza Lore. This program is free software; you +# can redistribute it and/or modify it under the terms of either the GNU +# Lesser General Public License Version 3 or the Perl Artistic License +# Version 2.0. +# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0 + +scenarios(dist => 1); + +my $root = ".."; + +### Must trim output before and after our file list +my %files = %{get_source_files($root)}; + +foreach my $file (sort keys %files) { + my $filename = "$root/$file"; + next if !-f $filename; # git file might be deleted but not yet staged + next unless $file =~ /\.(h|c|cpp)(\.in)?$/; + next if $file =~ /gtkwave/; + + my $contents = file_contents($filename); + + checkPattern($filename, $contents, + qr/virtual[^{};]+override/, + "'virtual' keyword is redundant on 'override' method"); +} + +ok(1); +1; + +sub get_source_files { + my $root = shift; + my $git_files = `cd $root && git ls-files`; + print "MF $git_files\n" if $Self->{verbose}; + my %files; + foreach my $file (split /\s+/, $git_files) { + next if $file eq ''; + $files{$file} |= 1; + } + return \%files; +} + +sub checkPattern { + my $filename = shift; + my $contents = shift; + my $pattern = shift; + my $message = shift; + + my $offset = 0; + my $buffer = $contents; + while ($buffer =~ s/.*?^[^\/]*($pattern)//sm) { + my $lineno = offset_to_lineno($contents, $offset + $-[1]); + $offset += $+[1]; + error("$filename:$lineno: $message"); + } +} + +sub offset_to_lineno { + my $contents = shift; + my $offset = shift; + my $count = (substr $contents, 0, $offset) =~ tr/\n//; + return $count + 1; +}