Have V3Life unlink at end to prevent proposed new-iteration scheme from breaking.
This commit is contained in:
parent
1b5e1943f5
commit
fe3b54bc2e
|
|
@ -34,6 +34,7 @@
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "V3Global.h"
|
#include "V3Global.h"
|
||||||
#include "V3Life.h"
|
#include "V3Life.h"
|
||||||
|
|
@ -53,13 +54,21 @@ class LifeState {
|
||||||
public:
|
public:
|
||||||
V3Double0 m_statAssnDel; // Statistic tracking
|
V3Double0 m_statAssnDel; // Statistic tracking
|
||||||
V3Double0 m_statAssnCon; // Statistic tracking
|
V3Double0 m_statAssnCon; // Statistic tracking
|
||||||
|
vector<AstNode*> m_unlinkps;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// CONSTRUCTORS
|
||||||
LifeState() {}
|
LifeState() {}
|
||||||
~LifeState() {
|
~LifeState() {
|
||||||
V3Stats::addStat("Optimizations, Lifetime assign deletions", m_statAssnDel);
|
V3Stats::addStat("Optimizations, Lifetime assign deletions", m_statAssnDel);
|
||||||
V3Stats::addStat("Optimizations, Lifetime constant prop", m_statAssnCon);
|
V3Stats::addStat("Optimizations, Lifetime constant prop", m_statAssnCon);
|
||||||
|
for (vector<AstNode*>::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()) {
|
if (AstNode* oldassp = entp->assignp()) {
|
||||||
UINFO(7," PREV: "<<oldassp<<endl);
|
UINFO(7," PREV: "<<oldassp<<endl);
|
||||||
// Redundant assignment, in same level block
|
// Redundant assignment, in same level block
|
||||||
|
// Don't delete it now as it will confuse iteration since it maybe WAY
|
||||||
|
// above our current iteration point.
|
||||||
if (debug()>4) oldassp->dumpTree(cout, " REMOVE/SAMEBLK ");
|
if (debug()>4) oldassp->dumpTree(cout, " REMOVE/SAMEBLK ");
|
||||||
entp->complexAssign();
|
entp->complexAssign();
|
||||||
oldassp->unlinkFrBack()->deleteTree(); oldassp=NULL;
|
m_statep->pushUnlinkDeletep(oldassp); oldassp=NULL;
|
||||||
m_statep->m_statAssnDel++;
|
m_statep->m_statAssnDel++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,7 @@ void process () {
|
||||||
|
|
||||||
// Loop unrolling & convert FORs to WHILEs
|
// Loop unrolling & convert FORs to WHILEs
|
||||||
V3Unroll::unrollAll(v3Global.rootp());
|
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
|
// Convert case statements to if() blocks. Must be after V3Unknown
|
||||||
V3Case::caseAll(v3Global.rootp());
|
V3Case::caseAll(v3Global.rootp());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue