Avoid duplicated scans of CFuncs.

Trace into non-entry-point functions (most of them) at their call
sites. We'll trace into entry-point functions (like eval) from their parent
scope. We must trace eval_ to reach the tree of calls beneath it.

Signed-off-by: Wilson Snyder <[email protected]>
This commit is contained in:
John Coiner
2017-11-28 18:38:19 -05:00
committed by Wilson Snyder
parent 791d02a753
commit 631bda395d
4 changed files with 53 additions and 19 deletions
+10 -3
View File
@@ -53,6 +53,7 @@ private:
V3Double0 m_statInstrLong; // Instruction count
bool m_counting; // Currently counting
double m_instrs; // Current instr count (for determining branch direction)
bool m_tracingCall; // Iterating into a CCall to a CFunc
vector<V3Double0> m_statTypeCount; // Nodes of given type
V3Double0 m_statAbove[AstType::_ENUM_END][AstType::_ENUM_END]; // Nodes of given type
@@ -192,12 +193,17 @@ private:
virtual void visit(AstCCall* nodep) {
allNodes(nodep);
nodep->iterateChildrenConst(*this);
if (m_fast) {
if (m_fast && !nodep->funcp()->entryPoint()) {
// Enter the function and trace it
nodep->funcp()->accept(*this);
}
m_tracingCall = true;
nodep->funcp()->accept(*this);
}
}
virtual void visit(AstCFunc* nodep) {
if (m_fast) {
if (!m_tracingCall && !nodep->entryPoint()) return;
m_tracingCall = false;
}
m_cfuncp = nodep;
allNodes(nodep);
nodep->iterateChildrenConst(*this);
@@ -215,6 +221,7 @@ public:
m_cfuncp = NULL;
m_counting = !m_fast;
m_instrs = 0;
m_tracingCall = false;
// Initialize arrays
m_statTypeCount.resize(AstType::_ENUM_END);
// Process