forked from github/verilator
Internals: Spacing change in prep for LifePost rewrite from branch. No functional change.
This commit is contained in:
parent
1fad055286
commit
2a5123f318
@ -39,18 +39,10 @@
|
|||||||
#include "V3Stats.h"
|
#include "V3Stats.h"
|
||||||
#include "V3Ast.h"
|
#include "V3Ast.h"
|
||||||
|
|
||||||
//######################################################################
|
|
||||||
// LifePost state, as a visitor of each AstNode
|
|
||||||
|
|
||||||
class LifePostBaseVisitor : public AstNVisitor {
|
|
||||||
protected:
|
|
||||||
VL_DEBUG_FUNC; // Declare debug()
|
|
||||||
};
|
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// LifePost class functions
|
// LifePost class functions
|
||||||
|
|
||||||
class LifePostElimVisitor : public LifePostBaseVisitor {
|
class LifePostElimVisitor : public AstNVisitor {
|
||||||
private:
|
private:
|
||||||
bool m_tracingCall; // Iterating into a CCall to a CFunc
|
bool m_tracingCall; // Iterating into a CCall to a CFunc
|
||||||
|
|
||||||
@ -58,6 +50,9 @@ private:
|
|||||||
// INPUT:
|
// INPUT:
|
||||||
// AstVarScope::user4p() -> AstVarScope*, If set, replace this varscope with specified new one
|
// AstVarScope::user4p() -> AstVarScope*, If set, replace this varscope with specified new one
|
||||||
// STATE
|
// STATE
|
||||||
|
// METHODS
|
||||||
|
VL_DEBUG_FUNC; // Declare debug()
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstVarRef* nodep) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
@ -102,7 +97,7 @@ public:
|
|||||||
//######################################################################
|
//######################################################################
|
||||||
// LifePost delay elimination
|
// LifePost delay elimination
|
||||||
|
|
||||||
class LifePostDlyVisitor : public LifePostBaseVisitor {
|
class LifePostDlyVisitor : public AstNVisitor {
|
||||||
private:
|
private:
|
||||||
// NODE STATE
|
// NODE STATE
|
||||||
// Cleared on entire tree
|
// Cleared on entire tree
|
||||||
@ -114,9 +109,12 @@ private:
|
|||||||
AstUser4InUse m_inuser4;
|
AstUser4InUse m_inuser4;
|
||||||
|
|
||||||
// STATE
|
// STATE
|
||||||
uint32_t m_sequence; // Sequence number of assignments/varrefs
|
uint32_t m_sequence; // Sequence number of assigns/varrefs,
|
||||||
V3Double0 m_statAssnDel; // Statistic tracking
|
V3Double0 m_statAssnDel; // Statistic tracking
|
||||||
bool m_tracingCall; // Tracing a CCall to a CFunc
|
bool m_tracingCall; // Currently tracing a CCall to a CFunc
|
||||||
|
|
||||||
|
// METHODS
|
||||||
|
VL_DEBUG_FUNC; // Declare debug()
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
virtual void visit(AstTopScope* nodep) {
|
virtual void visit(AstTopScope* nodep) {
|
||||||
@ -129,7 +127,6 @@ private:
|
|||||||
// Replace any node4p varscopes with the new scope
|
// Replace any node4p varscopes with the new scope
|
||||||
LifePostElimVisitor visitor (nodep);
|
LifePostElimVisitor visitor (nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstVarRef* nodep) {
|
virtual void visit(AstVarRef* nodep) {
|
||||||
// Consumption/generation of a variable,
|
// Consumption/generation of a variable,
|
||||||
AstVarScope* vscp = nodep->varScopep();
|
AstVarScope* vscp = nodep->varScopep();
|
||||||
@ -143,7 +140,6 @@ private:
|
|||||||
vscp->user2(m_sequence);
|
vscp->user2(m_sequence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstAssignPre* nodep) {
|
virtual void visit(AstAssignPre* nodep) {
|
||||||
// Do not record varrefs within assign pre.
|
// Do not record varrefs within assign pre.
|
||||||
//
|
//
|
||||||
@ -151,7 +147,6 @@ private:
|
|||||||
// first write; we only want to consider reads and writes that
|
// first write; we only want to consider reads and writes that
|
||||||
// would still happen if the dly var were eliminated.
|
// would still happen if the dly var were eliminated.
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void visit(AstAssignPost* nodep) {
|
virtual void visit(AstAssignPost* nodep) {
|
||||||
if (AstVarRef* lhsp = VN_CAST(nodep->lhsp(), VarRef)) {
|
if (AstVarRef* lhsp = VN_CAST(nodep->lhsp(), VarRef)) {
|
||||||
if (AstVarRef* rhsp = VN_CAST(nodep->rhsp(), VarRef)) {
|
if (AstVarRef* rhsp = VN_CAST(nodep->rhsp(), VarRef)) {
|
||||||
@ -201,7 +196,6 @@ private:
|
|||||||
m_tracingCall = false;
|
m_tracingCall = false;
|
||||||
iterateChildren(nodep);
|
iterateChildren(nodep);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----
|
//-----
|
||||||
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
||||||
virtual void visit(AstNode* nodep) {
|
virtual void visit(AstNode* nodep) {
|
||||||
@ -226,7 +220,7 @@ void V3LifePost::lifepostAll(AstNetlist* nodep) {
|
|||||||
UINFO(2,__FUNCTION__<<": "<<endl);
|
UINFO(2,__FUNCTION__<<": "<<endl);
|
||||||
// Mark redundant AssignPost
|
// Mark redundant AssignPost
|
||||||
{
|
{
|
||||||
LifePostDlyVisitor visitor (nodep);
|
LifePostDlyVisitor visitor(nodep);
|
||||||
} // Destruct before checking
|
} // Destruct before checking
|
||||||
V3Global::dumpCheckGlobalTree("life_post", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
|
V3Global::dumpCheckGlobalTree("life_post", 0, v3Global.opt.dumpTreeLevel(__FILE__) >= 3);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user