diff --git a/src/V3Life.cpp b/src/V3Life.cpp index 885326f0a..ba78c7813 100644 --- a/src/V3Life.cpp +++ b/src/V3Life.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include "V3Global.h" #include "V3Life.h" @@ -53,13 +54,21 @@ class LifeState { public: V3Double0 m_statAssnDel; // Statistic tracking V3Double0 m_statAssnCon; // Statistic tracking + vector m_unlinkps; public: + // CONSTRUCTORS LifeState() {} ~LifeState() { V3Stats::addStat("Optimizations, Lifetime assign deletions", m_statAssnDel); V3Stats::addStat("Optimizations, Lifetime constant prop", m_statAssnCon); + for (vector::iterator it = m_unlinkps.begin(); it != m_unlinkps.end(); ++it) { + (*it)->unlinkFrBack(); + (*it)->deleteTree(); + } } + // METHODS + void pushUnlinkDeletep(AstNode* nodep) { m_unlinkps.push_back(nodep); } }; //###################################################################### @@ -144,9 +153,11 @@ public: if (AstNode* oldassp = entp->assignp()) { UINFO(7," PREV: "<4) oldassp->dumpTree(cout, " REMOVE/SAMEBLK "); entp->complexAssign(); - oldassp->unlinkFrBack()->deleteTree(); oldassp=NULL; + m_statep->pushUnlinkDeletep(oldassp); oldassp=NULL; m_statep->m_statAssnDel++; } } diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 3dd996878..e1c46a38d 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -267,7 +267,7 @@ void process () { // Loop unrolling & convert FORs to WHILEs V3Unroll::unrollAll(v3Global.rootp()); - //v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("unroll.tree")); + v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("unroll.tree")); // Convert case statements to if() blocks. Must be after V3Unknown V3Case::caseAll(v3Global.rootp());