Internals: Cleanups (from parse branch). No functional change intended.

This commit is contained in:
Wilson Snyder 2025-04-27 14:17:24 -04:00
parent eb5676366b
commit cb1661f9d0
11 changed files with 25 additions and 16 deletions

View File

@ -1861,10 +1861,10 @@ void AstIfaceRefDType::dump(std::ostream& str) const {
if (ifaceName() != "") str << " if=" << ifaceName();
if (modportName() != "") str << " mp=" << modportName();
if (cellp()) {
str << " -> ";
str << " c-> ";
cellp()->dump(str);
} else if (ifacep()) {
str << " -> ";
str << " i-> ";
ifacep()->dump(str);
} else {
str << " -> UNLINKED";

View File

@ -132,7 +132,7 @@ private:
class CCtorsVisitor final : public VNVisitor {
// NODE STATE
// STATE
// STATE - for current visit position (use VL_RESTORER)
AstNodeModule* m_modp = nullptr; // Current module
AstCFunc* m_cfuncp = nullptr; // Current function
V3CCtorsBuilder* m_varResetp = nullptr; // Builder of _ctor_var_reset

View File

@ -45,7 +45,7 @@ class CleanVisitor final : public VNVisitor {
// TYPES
enum CleanState : uint8_t { CS_UNKNOWN, CS_CLEAN, CS_DIRTY };
// STATE
// STATE - for current visit position (use VL_RESTORER)
const AstNodeModule* m_modp = nullptr;
// METHODS

View File

@ -68,8 +68,9 @@ public:
class ClockVisitor final : public VNVisitor {
// NODE STATE
// STATE
AstCFunc* m_evalp = nullptr; // The '_eval' function
AstCFunc* const m_evalp = nullptr; // The '_eval' function
AstSenTree* m_lastSenp = nullptr; // Last sensitivity match, so we can detect duplicates.
AstIf* m_lastIfp = nullptr; // Last sensitivity if active to add more under
@ -174,8 +175,8 @@ class ClockVisitor final : public VNVisitor {
public:
// CONSTRUCTORS
explicit ClockVisitor(AstNetlist* netlistp) {
m_evalp = netlistp->evalp();
explicit ClockVisitor(AstNetlist* netlistp)
: m_evalp{netlistp->evalp()} {
// Simplify all SenTrees
for (AstSenTree* senTreep = netlistp->topScopep()->senTreesp(); senTreep;
senTreep = VN_AS(senTreep->nextp(), SenTree)) {

View File

@ -36,7 +36,7 @@ VL_DEFINE_DEBUG_FUNCTIONS;
class DepthVisitor final : public VNVisitor {
// NODE STATE
// STATE
// STATE - for current visit position (use VL_RESTORER)
AstCFunc* m_cfuncp = nullptr; // Current block
AstMTaskBody* m_mtaskbodyp = nullptr; // Current mtaskbody
AstNode* m_stmtp = nullptr; // Current statement
@ -71,6 +71,8 @@ class DepthVisitor final : public VNVisitor {
void visit(AstCFunc* nodep) override {
VL_RESTORER(m_cfuncp);
VL_RESTORER(m_mtaskbodyp);
VL_RESTORER(m_depth);
VL_RESTORER(m_maxdepth);
m_cfuncp = nodep;
m_mtaskbodyp = nullptr;
m_depth = 0;
@ -81,6 +83,8 @@ class DepthVisitor final : public VNVisitor {
void visit(AstMTaskBody* nodep) override {
VL_RESTORER(m_cfuncp);
VL_RESTORER(m_mtaskbodyp);
VL_RESTORER(m_depth);
VL_RESTORER(m_maxdepth);
m_cfuncp = nullptr;
m_mtaskbodyp = nodep;
m_depth = 0;
@ -90,6 +94,8 @@ class DepthVisitor final : public VNVisitor {
}
void visitStmt(AstNodeStmt* nodep) {
VL_RESTORER(m_stmtp);
VL_RESTORER(m_depth);
VL_RESTORER(m_maxdepth);
m_stmtp = nodep;
m_depth = 0;
m_maxdepth = 0;

View File

@ -33,7 +33,7 @@ VL_DEFINE_DEBUG_FUNCTIONS;
class DepthBlockVisitor final : public VNVisitor {
// NODE STATE
// STATE
// STATE - for current visit position (use VL_RESTORER)
const AstNodeModule* m_modp = nullptr; // Current module
const AstCFunc* m_cfuncp = nullptr; // Current function
int m_depth = 0; // How deep in an expression
@ -85,7 +85,7 @@ class DepthBlockVisitor final : public VNVisitor {
void visit(AstStmtExpr* nodep) override {} // Stop recursion after introducing new function
void visit(AstJumpBlock*) override {} // Stop recursion as can't break up across a jump
void visit(AstNodeStmt* nodep) override {
m_depth++;
++m_depth;
if (m_depth > v3Global.opt.compLimitBlocks()) { // Already done
UINFO(4, "DeepBlocks " << m_depth << " " << nodep << endl);
const AstNode* const backp = nodep->backp(); // Only for debug
@ -97,7 +97,7 @@ class DepthBlockVisitor final : public VNVisitor {
} else {
iterateChildren(nodep);
}
m_depth--;
--m_depth;
}
void visit(AstNodeExpr*) override {} // Accelerate

View File

@ -47,6 +47,7 @@ class LifePostElimVisitor final : public VNVisitor {
// INPUT:
// AstVarScope::user4p() -> AstVarScope*, If set, replace this
// varscope with specified new one
// STATE
// VISITORS

View File

@ -125,7 +125,7 @@ class LinkCellsVisitor final : public VNVisitor {
return nodep->user1u().toGraphVertex();
}
void newEdge(V3GraphVertex* fromp, V3GraphVertex* top, int weight, bool cuttable) {
V3GraphEdge* const edgep = new V3GraphEdge{&m_graph, fromp, top, weight, cuttable};
const V3GraphEdge* const edgep = new V3GraphEdge{&m_graph, fromp, top, weight, cuttable};
UINFO(9, " newEdge " << edgep << " " << fromp->name() << " -> " << top->name() << endl);
}

View File

@ -35,7 +35,8 @@ class SampledVisitor final : public VNVisitor {
// AstVarScope::user1() -> AstVarScope*. The VarScope that stores sampled value
// AstVarRef::user1() -> bool. Whether already converted
const VNUser1InUse m_user1InUse;
// STATE
// STATE - for current visit position (use VL_RESTORER)
AstScope* m_scopep = nullptr; // Current scope
bool m_inSampled = false; // True inside a sampled expression

View File

@ -32,7 +32,7 @@
// And provide functions to find/add a new one
class SenTreeFinder final {
// STATE
// STATE - across all visitors
AstTopScope* const m_topScopep; // Top scope to add global SenTrees to
std::unordered_set<VNRef<AstSenTree>> m_trees; // Set of global SenTrees
AstSenTree* m_combop = nullptr; // The unique combinational domain SenTree

View File

@ -170,8 +170,8 @@ public:
class SubstUseVisitor final : public VNVisitorConst {
// NODE STATE
// See SubstVisitor
//
// STATE
// STATE - across all visitors
const int m_origStep; // Step number where subst was recorded
bool m_ok = true; // No misassignments found