Internals: Use VL_RESTORER class to save/restore vars. No functional change intended.

This commit is contained in:
Wilson Snyder
2020-08-24 21:13:28 -04:00
parent 4265f9499d
commit bed3101dfc
42 changed files with 253 additions and 364 deletions
+4 -8
View File
@@ -135,28 +135,24 @@ private:
double ifInstrs = 0.0;
double elseInstrs = 0.0;
if (nodep->branchPred() != VBranchPred::BP_UNLIKELY) { // Check if
double prevInstr = m_instrs;
bool prevCounting = m_counting;
VL_RESTORER(m_instrs);
VL_RESTORER(m_counting);
{
m_counting = false;
m_instrs = 0.0;
iterateAndNextConstNull(nodep->ifsp());
ifInstrs = m_instrs;
}
m_instrs = prevInstr;
m_counting = prevCounting;
}
if (nodep->branchPred() != VBranchPred::BP_LIKELY) { // Check else
double prevInstr = m_instrs;
bool prevCounting = m_counting;
VL_RESTORER(m_instrs);
VL_RESTORER(m_counting);
{
m_counting = false;
m_instrs = 0.0;
iterateAndNextConstNull(nodep->elsesp());
elseInstrs = m_instrs;
}
m_instrs = prevInstr;
m_counting = prevCounting;
}
// Now collect the stats
if (m_counting) {