Internals: Cleanup some missing VL_RESTORER in V3Gate. No functional change intended.

This commit is contained in:
Wilson Snyder 2023-05-21 12:49:07 -04:00
parent 65667356b6
commit 950e29d56e
2 changed files with 29 additions and 40 deletions

View File

@ -53,7 +53,7 @@ class GateLogicVertex;
class GateVarVertex; class GateVarVertex;
class GateGraphBaseVisitor VL_NOT_FINAL { class GateGraphBaseVisitor VL_NOT_FINAL {
public: public:
V3Graph* m_graphp; // Graph this class is visiting V3Graph* const m_graphp; // Graph this class is visiting
explicit GateGraphBaseVisitor(V3Graph* graphp) explicit GateGraphBaseVisitor(V3Graph* graphp)
: m_graphp{graphp} {} : m_graphp{graphp} {}
virtual ~GateGraphBaseVisitor() = default; virtual ~GateGraphBaseVisitor() = default;
@ -199,10 +199,11 @@ private:
GateVarRefList m_rhsVarRefs; // VarRefs on rhs of assignment GateVarRefList m_rhsVarRefs; // VarRefs on rhs of assignment
AstNode* m_substTreep = nullptr; // What to replace the variable with AstNode* m_substTreep = nullptr; // What to replace the variable with
// STATE // STATE
bool m_buffersOnly; // Set when we only allow simple buffering, no equations (for clocks) const bool
m_buffersOnly; // Set when we only allow simple buffering, no equations (for clocks)
const AstNodeVarRef* m_lhsVarRef const AstNodeVarRef* m_lhsVarRef
= nullptr; // VarRef on lhs of assignment (what we're replacing) = nullptr; // VarRef on lhs of assignment (what we're replacing)
bool m_dedupe; // Set when we use isGateDedupable instead of isGateOptimizable const bool m_dedupe; // Set when we use isGateDedupable instead of isGateOptimizable
int m_ops = 0; // Operation count int m_ops = 0; // Operation count
// METHODS // METHODS
@ -277,9 +278,9 @@ private:
public: public:
// CONSTRUCTORS // CONSTRUCTORS
GateOkVisitor(AstNode* nodep, bool buffersOnly, bool dedupe) { GateOkVisitor(AstNode* nodep, bool buffersOnly, bool dedupe)
m_buffersOnly = buffersOnly; : m_buffersOnly{buffersOnly}
m_dedupe = dedupe; , m_dedupe{dedupe} {
// Iterate // Iterate
iterateConst(nodep); iterateConst(nodep);
// Check results // Check results
@ -452,29 +453,28 @@ private:
} }
void visit(AstNodeModule* nodep) override { void visit(AstNodeModule* nodep) override {
VL_RESTORER(m_modp); VL_RESTORER(m_modp);
{ VL_RESTORER(m_activeReducible);
m_modp = nodep; m_modp = nodep;
m_activeReducible = true; m_activeReducible = true;
iterateChildren(nodep); iterateChildren(nodep);
} }
}
void visit(AstScope* nodep) override { void visit(AstScope* nodep) override {
UINFO(4, " SCOPE " << nodep << endl); UINFO(4, " SCOPE " << nodep << endl);
VL_RESTORER(m_scopep);
m_scopep = nodep; m_scopep = nodep;
m_logicVertexp = nullptr; m_logicVertexp = nullptr;
iterateChildren(nodep); iterateChildren(nodep);
m_scopep = nullptr;
} }
void visit(AstActive* nodep) override { void visit(AstActive* nodep) override {
// Create required blocks and add to module // Create required blocks and add to module
UINFO(4, " BLOCK " << nodep << endl); UINFO(4, " BLOCK " << nodep << endl);
VL_RESTORER(m_activep);
VL_RESTORER(m_activeReducible);
m_activeReducible = !(nodep->hasClocked()); // Seq logic outputs aren't reducible m_activeReducible = !(nodep->hasClocked()); // Seq logic outputs aren't reducible
m_activep = nodep; m_activep = nodep;
AstNode::user2ClearTree(); AstNode::user2ClearTree();
iterateChildren(nodep); iterateChildren(nodep);
AstNode::user2ClearTree(); AstNode::user2ClearTree();
m_activep = nullptr;
m_activeReducible = true;
} }
void visit(AstNodeVarRef* nodep) override { void visit(AstNodeVarRef* nodep) override {
if (m_scopep) { if (m_scopep) {
@ -506,31 +506,26 @@ private:
} }
void visit(AstAlwaysPublic* nodep) override { void visit(AstAlwaysPublic* nodep) override {
VL_RESTORER(m_inSlow); VL_RESTORER(m_inSlow);
{
m_inSlow = true; m_inSlow = true;
iterateNewStmt(nodep, "AlwaysPublic", nullptr); iterateNewStmt(nodep, "AlwaysPublic", nullptr);
} }
}
void visit(AstCFunc* nodep) override { void visit(AstCFunc* nodep) override {
iterateNewStmt(nodep, "User C Function", "User C Function"); iterateNewStmt(nodep, "User C Function", "User C Function");
} }
void visit(AstClocking* nodep) override { iterateNewStmt(nodep, nullptr, nullptr); } void visit(AstClocking* nodep) override { iterateNewStmt(nodep, nullptr, nullptr); }
void visit(AstSenItem* nodep) override { void visit(AstSenItem* nodep) override {
VL_RESTORER(m_inSenItem);
m_inSenItem = true; m_inSenItem = true;
if (m_logicVertexp) { // Already under logic; presumably a SenGate if (m_logicVertexp) { // Already under logic; presumably a SenGate
iterateChildren(nodep); iterateChildren(nodep);
} else { // Standalone item, probably right under a SenTree } else { // Standalone item, probably right under a SenTree
iterateNewStmt(nodep, nullptr, nullptr); iterateNewStmt(nodep, nullptr, nullptr);
} }
m_inSenItem = false;
} }
void visit(AstNodeProcedure* nodep) override { void visit(AstNodeProcedure* nodep) override {
VL_RESTORER(m_inSlow); VL_RESTORER(m_inSlow);
{
m_inSlow = VN_IS(nodep, Initial) || VN_IS(nodep, Final); m_inSlow = VN_IS(nodep, Initial) || VN_IS(nodep, Final);
iterateNewStmt(nodep, (nodep->isJustOneBodyStmt() ? nullptr : "Multiple Stmts"), iterateNewStmt(nodep, (nodep->isJustOneBodyStmt() ? nullptr : "Multiple Stmts"), nullptr);
nullptr);
}
} }
void visit(AstAssignAlias* nodep) override { // void visit(AstAssignAlias* nodep) override { //
iterateNewStmt(nodep, nullptr, nullptr); iterateNewStmt(nodep, nullptr, nullptr);
@ -543,11 +538,9 @@ private:
} }
void visit(AstTraceDecl* nodep) override { void visit(AstTraceDecl* nodep) override {
VL_RESTORER(m_inSlow); VL_RESTORER(m_inSlow);
{
m_inSlow = true; m_inSlow = true;
iterateNewStmt(nodep, "Tracing", "Tracing"); iterateNewStmt(nodep, "Tracing", "Tracing");
} }
}
void visit(AstConcat* nodep) override { void visit(AstConcat* nodep) override {
UASSERT_OBJ(!(VN_IS(nodep->backp(), NodeAssign) UASSERT_OBJ(!(VN_IS(nodep->backp(), NodeAssign)
&& VN_AS(nodep->backp(), NodeAssign)->lhsp() == nodep), && VN_AS(nodep->backp(), NodeAssign)->lhsp() == nodep),
@ -1269,9 +1262,7 @@ private:
public: public:
explicit GateMergeAssignsGraphVisitor(V3Graph* graphp) explicit GateMergeAssignsGraphVisitor(V3Graph* graphp)
: GateGraphBaseVisitor{graphp} { : GateGraphBaseVisitor{graphp} {}
m_graphp = graphp; // In base
}
void mergeAssignsTree(GateVarVertex* vvertexp) { vvertexp->accept(*this); } void mergeAssignsTree(GateVarVertex* vvertexp) { vvertexp->accept(*this); }
VDouble0 numMergedAssigns() { return m_numMergedAssigns; } VDouble0 numMergedAssigns() { return m_numMergedAssigns; }
}; };
@ -1370,8 +1361,8 @@ private:
if (vsp->user2SetOnce()) return VNUser{0}; if (vsp->user2SetOnce()) return VNUser{0};
UINFO(9, "CLK DECOMP Var - " << vvertexp << " : " << vsp << endl); UINFO(9, "CLK DECOMP Var - " << vvertexp << " : " << vsp << endl);
if (vsp->varp()->width() > 1) { if (vsp->varp()->width() > 1) {
m_seen_clk_vectors++; ++m_seen_clk_vectors;
m_total_seen_clk_vectors++; ++m_total_seen_clk_vectors;
} }
const GateClkDecompState* const currState = reinterpret_cast<GateClkDecompState*>(vu.c()); const GateClkDecompState* const currState = reinterpret_cast<GateClkDecompState*>(vu.c());
GateClkDecompState nextState{currState->m_offset, vsp}; GateClkDecompState nextState{currState->m_offset, vsp};

View File

@ -133,13 +133,11 @@ private:
UINFO(4, " CFUNC " << nodep << endl); UINFO(4, " CFUNC " << nodep << endl);
VL_RESTORER(m_cfuncp); VL_RESTORER(m_cfuncp);
VL_RESTORER(m_nodeDepth); VL_RESTORER(m_nodeDepth);
{
m_cfuncp = nodep; m_cfuncp = nodep;
m_nodeDepth = 0; m_nodeDepth = 0;
const VNUser2InUse user2InUse; const VNUser2InUse user2InUse;
iterateChildrenConst(nodep); iterateChildrenConst(nodep);
} }
}
void visit(AstCCall* nodep) override { void visit(AstCCall* nodep) override {
m_cfuncp->user1(true); // Mark caller as not a leaf function m_cfuncp->user1(true); // Mark caller as not a leaf function
@ -204,9 +202,9 @@ private:
} }
void visit(AstNode* nodep) override { void visit(AstNode* nodep) override {
VL_RESTORER(m_nodeDepth);
++m_nodeDepth; ++m_nodeDepth;
iterateChildrenConst(nodep); iterateChildrenConst(nodep);
--m_nodeDepth;
} }
public: public: