cleanup of some comments
This commit is contained in:
parent
7a49fdf9f3
commit
6850b3653e
|
|
@ -59,7 +59,6 @@ private:
|
|||
m_curTaskp = nodep;
|
||||
++g_stats.ftasks;
|
||||
UINFO(DBG, "UndrivenCapture: enter ftask " << nodep << " " << nodep->prettyNameQ());
|
||||
//(void)m_cap.ensureEntry(nodep); // ensure map entry exists
|
||||
m_cap.info(nodep);
|
||||
iterateListConst(*this, nodep->stmtsp());
|
||||
}
|
||||
|
|
@ -68,11 +67,6 @@ private:
|
|||
if (m_curTaskp && nodep->access().isWriteOrRW()) {
|
||||
++g_stats.varWrites;
|
||||
UINFO(DBG, "UndrivenCapture: direct write in " << taskNameQ(m_curTaskp) << " var=" << nodep->varp()->prettyNameQ() << " at " << nodep->fileline());
|
||||
// Ensure entry exists
|
||||
//(void)m_cap.ensureEntry(m_curTaskp);
|
||||
// Safe: find() must succeed after writeSummary() creates entry
|
||||
//auto* const infop = const_cast<V3UndrivenCapture::FTaskInfo*>(m_cap.find(m_curTaskp));
|
||||
//if (infop) infop->directWrites.push_back(nodep->varp());
|
||||
m_cap.info(m_curTaskp).directWrites.push_back(nodep->varp());
|
||||
}
|
||||
iterateChildrenConst(nodep);
|
||||
|
|
@ -84,14 +78,8 @@ private:
|
|||
if (AstNodeFTask* const calleep = nodep->taskp()) {
|
||||
++g_stats.callEdges;
|
||||
UINFO(DBG, "UndrivenCapture: call edge " << taskNameQ(m_curTaskp) << " -> " << taskNameQ(calleep));
|
||||
//(void)m_cap.ensureEntry(m_curTaskp);
|
||||
//(void)m_cap.ensureEntry(calleep);
|
||||
//auto* const infop
|
||||
// = const_cast<V3UndrivenCapture::FTaskInfo*>(m_cap.find(m_curTaskp));
|
||||
//if (infop) infop->callees.push_back(calleep);
|
||||
m_cap.info(m_curTaskp).callees.push_back(calleep);
|
||||
m_cap.info(calleep); // ensure entry exists for callee too (optional but keeps map complete)
|
||||
|
||||
m_cap.info(calleep);
|
||||
} else {
|
||||
UINFO(DBG, "UndrivenCapture: unresolved call in " << taskNameQ(m_curTaskp) << " name=" << nodep->name());
|
||||
}
|
||||
|
|
@ -127,7 +115,7 @@ V3UndrivenCapture::V3UndrivenCapture(AstNetlist* netlistp) {
|
|||
sortUniqueFTasks(kv.second.callees);
|
||||
}
|
||||
|
||||
// Compute summaries for all tasks (MVP: DFS memoization, no SCC yet)
|
||||
// Compute summaries for all tasks
|
||||
for (const auto& kv : m_info) (void)computeWriteSummary(kv.first);
|
||||
|
||||
UINFO(DBG, "UndrivenCapture: stats ftasks=" << g_stats.ftasks << " varWrites=" << g_stats.varWrites << " callEdges=" << g_stats.callEdges << " uniqueTasks=" << m_info.size());
|
||||
|
|
@ -159,7 +147,7 @@ const std::vector<V3UndrivenCapture::Var>& V3UndrivenCapture::computeWriteSummar
|
|||
}
|
||||
if (info.state == State::VISITING) {
|
||||
UINFO(DBG, "UndrivenCapture: recursion detected at " << taskNameQ(taskp) << " returning directWrites size=" << info.directWrites.size());
|
||||
// Cycle detected (recursion/mutual recursion). MVP behavior:
|
||||
// Cycle detected. Simple behaviour:
|
||||
// return directWrites only to guarantee termination.
|
||||
if (info.writeSummary.empty()) info.writeSummary = info.directWrites;
|
||||
sortUniqueVars(info.writeSummary);
|
||||
|
|
@ -199,6 +187,4 @@ void V3UndrivenCapture::debugDumpTask(FTask taskp, int level) const {
|
|||
<< " writeSummary=" << infop->writeSummary.size());
|
||||
}
|
||||
|
||||
//void V3UndrivenCapture::ensureEntry(FTask taskp) { (void)m_info[taskp]; }
|
||||
|
||||
V3UndrivenCapture::FTaskInfo& V3UndrivenCapture::info(FTask taskp) { return m_info[taskp]; }
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ public:
|
|||
std::vector<Var> directWrites;
|
||||
// Direct resolved callees from this task/function body.
|
||||
std::vector<FTask> callees;
|
||||
// Transitive "may write" summary: directWrites plus all callees' summaries.
|
||||
// 'write through write' writeSummary for the given task/function.
|
||||
std::vector<Var> writeSummary;
|
||||
// Memoization state for writeSummary computation.
|
||||
// state for writeSummary computation.
|
||||
State state = State::UNVISITED;
|
||||
};
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ private:
|
|||
|
||||
// Collect direct writes and call edges for all tasks/functions.
|
||||
void gather(AstNetlist* netlistp);
|
||||
// Compute (and memoize) transitive writeSummary for the given task/function.
|
||||
// Compute (and cache) 'write through write' writeSummary for the given task/function.
|
||||
const std::vector<Var>& computeWriteSummary(FTask taskp);
|
||||
|
||||
public:
|
||||
|
|
@ -70,13 +70,10 @@ public:
|
|||
|
||||
// Lookup task/function capture info (nullptr if unknown).
|
||||
const FTaskInfo* find(FTask taskp) const;
|
||||
// Get transitive writeSummary for a task/function (creates empty entry if needed).
|
||||
// Get write through write through write, etc (call chain) writeSummary for a task/function (creates empty entry if needed).
|
||||
const std::vector<Var>& writeSummary(FTask taskp);
|
||||
|
||||
// Ensure an entry exists for a task/function without computing its writeSummary.
|
||||
//void ensureEntry(FTask taskp);
|
||||
|
||||
// Optional: dump one task's summary (for debug bring-up). You can omit if you prefer.
|
||||
// Optional: dump one task's summary (for debug bring-up).
|
||||
void debugDumpTask(FTask taskp, int level = 9) const;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue