mirror of
https://github.com/verilator/verilator.git
synced 2026-10-06 01:54:01 +02:00
Avoid duplicated scans of CFuncs.
Trace into non-entry-point functions (most of them) at their call sites. We'll trace into entry-point functions (like eval) from their parent scope. We must trace eval_ to reach the tree of calls beneath it. Signed-off-by: Wilson Snyder <[email protected]>
This commit is contained in:
committed by
Wilson Snyder
parent
791d02a753
commit
631bda395d
+27
-6
@@ -56,6 +56,8 @@ protected:
|
||||
|
||||
class LifePostElimVisitor : public LifePostBaseVisitor {
|
||||
private:
|
||||
bool m_tracingCall; // Iterating into a CCall to a CFunc
|
||||
|
||||
// NODE STATE
|
||||
// INPUT:
|
||||
// AstVarScope::user4p() -> AstVarScope*, If set, replace this varscope with specified new one
|
||||
@@ -77,8 +79,16 @@ private:
|
||||
}
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
// Enter the function and trace it
|
||||
nodep->funcp()->accept(*this);
|
||||
if (!nodep->funcp()->entryPoint()) {
|
||||
// Enter the function and trace it
|
||||
m_tracingCall = true;
|
||||
nodep->funcp()->accept(*this);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
if (!m_tracingCall && !nodep->entryPoint()) return;
|
||||
m_tracingCall = false;
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
virtual void visit(AstVar*) {} // Don't want varrefs under it
|
||||
virtual void visit(AstNode* nodep) {
|
||||
@@ -86,7 +96,8 @@ private:
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit LifePostElimVisitor(AstTopScope* nodep) {
|
||||
explicit LifePostElimVisitor(AstTopScope* nodep)
|
||||
: m_tracingCall(false) {
|
||||
nodep->accept(*this);
|
||||
}
|
||||
virtual ~LifePostElimVisitor() {}
|
||||
@@ -109,6 +120,7 @@ private:
|
||||
// STATE
|
||||
uint32_t m_sequence; // Sequence number of assignments/varrefs
|
||||
V3Double0 m_statAssnDel; // Statistic tracking
|
||||
bool m_tracingCall; // Tracing a CCall to a CFunc
|
||||
|
||||
// VISITORS
|
||||
virtual void visit(AstTopScope* nodep) {
|
||||
@@ -167,8 +179,16 @@ private:
|
||||
}
|
||||
virtual void visit(AstCCall* nodep) {
|
||||
nodep->iterateChildren(*this);
|
||||
// Enter the function and trace it
|
||||
nodep->funcp()->accept(*this);
|
||||
if (!nodep->funcp()->entryPoint()) {
|
||||
// Enter the function and trace it
|
||||
m_tracingCall = true;
|
||||
nodep->funcp()->accept(*this);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstCFunc* nodep) {
|
||||
if (!m_tracingCall && !nodep->entryPoint()) return;
|
||||
m_tracingCall = false;
|
||||
nodep->iterateChildren(*this);
|
||||
}
|
||||
|
||||
//-----
|
||||
@@ -178,7 +198,8 @@ private:
|
||||
}
|
||||
public:
|
||||
// CONSTRUCTORS
|
||||
explicit LifePostDlyVisitor(AstNetlist* nodep) {
|
||||
explicit LifePostDlyVisitor(AstNetlist* nodep)
|
||||
: m_tracingCall(false) {
|
||||
nodep->accept(*this);
|
||||
}
|
||||
virtual ~LifePostDlyVisitor() {
|
||||
|
||||
Reference in New Issue
Block a user