mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Merge branch 'master' into develop-v5
This commit is contained in:
+20
-20
@@ -54,21 +54,21 @@ 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<AstVarScope*>(vscp->user4p())) {
|
||||
UINFO(9, " Replace " << nodep << " to " << newvscp << endl);
|
||||
AstVarRef* const newrefp = new AstVarRef(nodep->fileline(), newvscp, nodep->access());
|
||||
AstVarRef* const newrefp = new AstVarRef{nodep->fileline(), newvscp, nodep->access()};
|
||||
nodep->replaceWith(newrefp);
|
||||
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;
|
||||
};
|
||||
|
||||
//######################################################################
|
||||
@@ -256,7 +256,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
|
||||
@@ -280,7 +280,7 @@ private:
|
||||
// Replace any node4p varscopes with the new scope
|
||||
LifePostElimVisitor{nodep};
|
||||
}
|
||||
virtual void visit(AstVarRef* nodep) override {
|
||||
void visit(AstVarRef* nodep) override {
|
||||
// Mark variables referenced outside _eval__nba
|
||||
if (!m_inEvalNba) {
|
||||
nodep->varScopep()->user1(true);
|
||||
@@ -295,7 +295,7 @@ 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
|
||||
@@ -303,7 +303,7 @@ private:
|
||||
// would still happen if the dly var were eliminated.
|
||||
if (!m_inEvalNba) iterateChildren(nodep);
|
||||
}
|
||||
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)) {
|
||||
@@ -315,11 +315,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
|
||||
@@ -327,7 +327,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
|
||||
if (m_inEvalNba) {
|
||||
UASSERT_OBJ(!m_mtasksGraphp, nodep, "Cannot handle more than one AstExecGraph");
|
||||
@@ -342,7 +342,7 @@ private:
|
||||
}
|
||||
m_execMTaskp = nullptr;
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) override {
|
||||
void visit(AstCFunc* nodep) override {
|
||||
if (!m_tracingCall && !nodep->entryPoint()) return;
|
||||
VL_RESTORER(m_inEvalNba);
|
||||
if (nodep == m_evalNbap) m_inEvalNba = true;
|
||||
@@ -350,8 +350,8 @@ private:
|
||||
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
|
||||
@@ -359,7 +359,7 @@ public:
|
||||
: m_evalNbap{netlistp->evalNbap()} {
|
||||
iterate(netlistp);
|
||||
}
|
||||
virtual ~LifePostDlyVisitor() override {
|
||||
~LifePostDlyVisitor() override {
|
||||
V3Stats::addStat("Optimizations, Lifetime postassign deletions", m_statAssnDel);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user