diff --git a/src/V3Undriven.cpp b/src/V3Undriven.cpp index 4a54cd54a..0dfd6c353 100644 --- a/src/V3Undriven.cpp +++ b/src/V3Undriven.cpp @@ -315,7 +315,6 @@ class UndrivenVisitor final : public VNVisitorConst { const AstAlways* m_alwaysCombp = nullptr; // Current always if combo, otherwise nullptr V3UndrivenCapture* const m_capturep = nullptr; // Capture object. 'nullptr' if disabled. - const bool m_enableWriteSummary = false; // Enable writeSummary computation plumbing // METHODS @@ -437,7 +436,7 @@ class UndrivenVisitor final : public VNVisitorConst { // If writeSummary is enabled, task/function definitions are treated as non-executed. // Their effects are applied at call sites via writeSummary(), so don't let definition // traversal create phantom "other writes" for MULTIDRIVEN. - if (m_enableWriteSummary && m_taskp && !m_alwaysp && !m_inContAssign && !m_inInitialStatic + if (m_taskp && !m_alwaysp && !m_inContAssign && !m_inInitialStatic && !m_inBBox && !m_taskp->dpiExport()) { AstVar* const retVarp = VN_CAST(m_taskp->fvarp(), Var); if (!retVarp || nodep->varp() != retVarp) return; @@ -455,12 +454,13 @@ class UndrivenVisitor final : public VNVisitorConst { if (entryp->isDrivenWhole() && !m_inBBox && !VN_IS(nodep, VarXRef) && !VN_IS(nodep->dtypep()->skipRefp(), UnpackArrayDType) && nodep->fileline() != entryp->getNodeFileLinep() && !entryp->isUnderGen() - && (entryp->getNodep() || (m_enableWriteSummary && entryp->callNodep()))) { + && (entryp->getNodep() || + entryp->callNodep())) { const AstNode* const otherWritep - = entryp->getNodep() - ? static_cast(entryp->getNodep()) - : (m_enableWriteSummary ? entryp->callNodep() : nullptr); + = entryp->getNodep() ? + static_cast(entryp->getNodep()) : + entryp->callNodep(); if (m_alwaysCombp && (!entryp->isDrivenAlwaysCombWhole() @@ -557,7 +557,7 @@ class UndrivenVisitor final : public VNVisitorConst { iterateChildrenConst(nodep); - if (!m_enableWriteSummary || !m_capturep) return; + if (!m_capturep) return; // If writeSummary is enabled, task/function definitions are treated as non-executed. // Do not apply writeSummary at calls inside a task definition, or they will look like @@ -612,10 +612,9 @@ class UndrivenVisitor final : public VNVisitorConst { public: // CONSTRUCTORS - explicit UndrivenVisitor(AstNetlist* nodep, V3UndrivenCapture* capturep, - bool enableWriteSummary) + explicit UndrivenVisitor(AstNetlist* nodep, V3UndrivenCapture* capturep) : m_capturep{capturep} - , m_enableWriteSummary{enableWriteSummary} { + { iterateConst(nodep); } @@ -632,12 +631,9 @@ public: void V3Undriven::undrivenAll(AstNetlist* nodep) { UINFO(2, __FUNCTION__ << ":"); - const bool enable = V3UndrivenCapture::enableWriteSummary; - if (enable) { - V3UndrivenCapture capture{nodep}; - { UndrivenVisitor{nodep, &capture, enable}; } - } else { - { UndrivenVisitor{nodep, nullptr, enable}; } - } + + V3UndrivenCapture capture{nodep}; + UndrivenVisitor{nodep, &capture}; + if (v3Global.opt.stats()) V3Stats::statsStage("undriven"); } diff --git a/src/V3UndrivenCapture.cpp b/src/V3UndrivenCapture.cpp index cf4b279a0..991175121 100644 --- a/src/V3UndrivenCapture.cpp +++ b/src/V3UndrivenCapture.cpp @@ -19,8 +19,6 @@ #include "V3Error.h" #include "V3Global.h" -//#include - VL_DEFINE_DEBUG_FUNCTIONS; namespace { @@ -94,8 +92,6 @@ private: } // namespace -bool V3UndrivenCapture::enableWriteSummary = true; - V3UndrivenCapture::V3UndrivenCapture(AstNetlist* netlistp) { gather(netlistp); @@ -188,8 +184,7 @@ void V3UndrivenCapture::noteDirectWrite(const AstNodeFTask* taskp, AstVar* varp) AstVar* const retVarp = VN_CAST(taskp->fvarp(), Var); if (retVarp && varp == retVarp) return; - //info.directWrites.push_back(varp); - // filter out duplicates. + // Filter out duplicates. if (info.directWritesSet.insert(varp).second) { info.directWrites.push_back(varp); } @@ -197,11 +192,11 @@ void V3UndrivenCapture::noteDirectWrite(const AstNodeFTask* taskp, AstVar* varp) void V3UndrivenCapture::noteCallEdge(const AstNodeFTask* callerp, const AstNodeFTask* calleep) { FTaskInfo& callerInfo = m_info[callerp]; - // prevents duplicate entries from being appended, if calleep already exists then insert will return false, and then is not inserted into the callees vector. + // Prevents duplicate entries from being appended, if calleep already exists then insert will return false, and then is not inserted into the callees vector. if (callerInfo.calleesSet.insert(calleep).second) { callerInfo.callees.push_back(calleep); } - // ensure callee entry exists, if already exists then this is a no-op. unordered_map<> so cheap. + // Ensure callee entry exists, if already exists then this is a no-op. unordered_map<> so cheap. (void)m_info[calleep]; } diff --git a/src/V3UndrivenCapture.h b/src/V3UndrivenCapture.h index 7815eca61..573ab4f70 100644 --- a/src/V3UndrivenCapture.h +++ b/src/V3UndrivenCapture.h @@ -64,10 +64,6 @@ public: std::unordered_set directWritesSet; }; - // Enable writeSummary computation. If disabled, then the existing V3Undriven behaviour is - // used. - static bool enableWriteSummary; - private: // Per-task/function capture info keyed by resolved AstNodeFTask* identity (FTask = function or // task). This is our 'graph' of tasks/functions. Each node has a list of direct callees and