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

View File

@ -133,12 +133,10 @@ private:
UINFO(4, " CFUNC " << nodep << endl);
VL_RESTORER(m_cfuncp);
VL_RESTORER(m_nodeDepth);
{
m_cfuncp = nodep;
m_nodeDepth = 0;
const VNUser2InUse user2InUse;
iterateChildrenConst(nodep);
}
m_cfuncp = nodep;
m_nodeDepth = 0;
const VNUser2InUse user2InUse;
iterateChildrenConst(nodep);
}
void visit(AstCCall* nodep) override {
@ -204,9 +202,9 @@ private:
}
void visit(AstNode* nodep) override {
VL_RESTORER(m_nodeDepth);
++m_nodeDepth;
iterateChildrenConst(nodep);
--m_nodeDepth;
}
public: