Internals: Cleanup more VL_RESTORER. No functional change intended.

This commit is contained in:
Wilson Snyder 2023-05-21 14:06:39 -04:00
parent 950e29d56e
commit 140994d2c4
3 changed files with 22 additions and 24 deletions

View File

@ -92,21 +92,23 @@ private:
const VNUser4InUse m_inuser4;
const VNUser5InUse m_inuser5;
// STATE
// STATE - for current visit position (use VL_RESTORER)
AstActive* m_activep = nullptr; // Current activate
const AstCFunc* m_cfuncp = nullptr; // Current public C Function
AstAssignDly* m_nextDlyp = nullptr; // Next delayed assignment in a list of assignments
AstNodeProcedure* m_procp = nullptr; // Current process
std::set<AstSenTree*> m_timingDomains; // Timing resume domains
bool m_inDly = false; // True in delayed assignments
bool m_inLoop = false; // True in for loops
bool m_inInitial = false; // True in static initializers and initial blocks
bool m_inSuspendableOrFork = false; // True in suspendable processes and forks
bool m_ignoreBlkAndNBlk = false; // Suppress delayed assignment BLKANDNBLK
// STATE - across all visitors
std::unordered_map<const AstVarScope*, int> m_scopeVecMap; // Next var number for each scope
std::set<AstSenTree*> m_timingDomains; // Timing resume domains
using VarMap = std::map<const std::pair<AstNodeModule*, std::string>, AstVar*>;
VarMap m_modVarMap; // Table of new var names created under module
VDouble0 m_statSharedSet; // Statistic tracking
std::unordered_map<const AstVarScope*, int> m_scopeVecMap; // Next var number for each scope
// METHODS
@ -424,10 +426,8 @@ private:
}
void visit(AstCFunc* nodep) override {
VL_RESTORER(m_cfuncp);
{
m_cfuncp = nodep;
iterateChildren(nodep);
}
m_cfuncp = nodep;
iterateChildren(nodep);
}
void visit(AstActive* nodep) override {
m_activep = nodep;
@ -443,10 +443,12 @@ private:
void visit(AstNodeProcedure* nodep) override {
VL_RESTORER(m_inSuspendableOrFork);
m_inSuspendableOrFork = nodep->isSuspendable();
m_procp = nodep;
m_timingDomains.clear();
iterateChildren(nodep);
m_procp = nullptr;
{
VL_RESTORER(m_procp);
m_procp = nodep;
m_timingDomains.clear();
iterateChildren(nodep);
}
if (m_timingDomains.empty()) return;
if (auto* const actp = VN_AS(nodep->user3p(), Active)) {
// Merge all timing domains (and possibly the active's domain) to create a sentree for
@ -618,10 +620,8 @@ private:
}
void visit(AstWhile* nodep) override {
VL_RESTORER(m_inLoop);
{
m_inLoop = true;
iterateChildren(nodep);
}
m_inLoop = true;
iterateChildren(nodep);
}
//--------------------

View File

@ -57,11 +57,13 @@ private:
AstUser4Allocator<AstCFunc, std::unordered_multimap<const AstVarScope*, AstVarRef*>>
m_references;
// STATE
VDouble0 m_statLocVars; // Statistic tracking
// STATE - for current visit position (use VL_RESTORER)
AstCFunc* m_cfuncp = nullptr; // Current active function
uint32_t m_nodeDepth = 0; // Node depth under m_cfuncp
// STATE - across all visitors
std::vector<AstVarScope*> m_varScopeps; // List of variables to consider for localization
VDouble0 m_statLocVars; // Statistic tracking
// METHODS
bool isOptimizable(AstVarScope* nodep) {

View File

@ -53,15 +53,16 @@ private:
const VNUser1InUse m_inuser1;
const VNUser2InUse m_inuser2;
// STATE
// STATE - for current visit position (use VL_RESTORER)
AstCFunc* m_cfuncp = nullptr; // Current block
AstNode* m_stmtp = nullptr; // Current statement
AstCCall* m_callp = nullptr; // Current AstCCall
AstWhile* m_inWhilep = nullptr; // Inside while loop, special statement additions
AstTraceInc* m_inTracep = nullptr; // Inside while loop, special statement additions
bool m_assignLhs = false; // Inside assignment lhs, don't breakup extracts
V3UniqueNames m_tempNames; // For generating unique temporary variable names
// STATE - across all visitors
V3UniqueNames m_tempNames; // For generating unique temporary variable names
VDouble0 m_extractedToConstPool; // Statistic tracking
// METHODS
@ -186,7 +187,6 @@ private:
startStatement(nodep);
iterateAndNextNull(nodep->stmtsp());
iterateAndNextNull(nodep->incsp());
m_stmtp = nullptr;
}
void visit(AstNodeAssign* nodep) override {
RESTORER_START_STATEMENT();
@ -216,14 +216,12 @@ private:
m_assignLhs = true;
iterateAndNextNull(nodep->lhsp());
}
m_stmtp = nullptr;
}
void visit(AstNodeStmt* nodep) override {
UINFO(4, " STMT " << nodep << endl);
RESTORER_START_STATEMENT();
startStatement(nodep);
iterateChildren(nodep);
m_stmtp = nullptr;
}
void visit(AstTraceInc* nodep) override {
RESTORER_START_STATEMENT();
@ -231,7 +229,6 @@ private:
VL_RESTORER(m_inTracep);
m_inTracep = nodep;
iterateChildren(nodep);
m_stmtp = nullptr;
}
void visitShift(AstNodeBiop* nodep) {
// Shifts of > 32/64 bits in C++ will wrap-around and generate non-0s
@ -361,7 +358,6 @@ private:
RESTORER_START_STATEMENT();
startStatement(nodep);
iterateChildren(nodep);
m_stmtp = nullptr;
if (v3Global.opt.autoflush()) {
const AstNode* searchp = nodep->nextp();
while (searchp && VN_IS(searchp, Comment)) searchp = searchp->nextp();