removed ensureEntry
This commit is contained in:
parent
fd60e349ee
commit
7a49fdf9f3
|
|
@ -568,14 +568,7 @@ class UndrivenVisitor final : public VNVisitorConst {
|
|||
iterateChildrenConst(nodep);
|
||||
if (nodep->keyword() == VAlwaysKwd::ALWAYS_COMB) UINFO(9, " Done " << nodep);
|
||||
}
|
||||
// EOM
|
||||
/*
|
||||
void visit(AstNodeFTaskRef* nodep) override {
|
||||
VL_RESTORER(m_inFTaskRef);
|
||||
m_inFTaskRef = true;
|
||||
iterateChildrenConst(nodep);
|
||||
}
|
||||
*/
|
||||
|
||||
void visit(AstNodeFTaskRef* nodep) override {
|
||||
VL_RESTORER(m_inFTaskRef);
|
||||
m_inFTaskRef = true;
|
||||
|
|
@ -584,11 +577,18 @@ class UndrivenVisitor final : public VNVisitorConst {
|
|||
|
||||
if (!m_enableWriteSummary || !m_capturep) return;
|
||||
|
||||
// EOM
|
||||
// If writeSummary is enabled, task/function definitions are treated as non-executed.
|
||||
// Do not apply writeSummary at calls inside a task definition, or they will look like
|
||||
// independent drivers (phantom MULTIDRIVEN).
|
||||
if (m_taskp && !m_alwaysp && !m_inContAssign && !m_inInitialStatic && !m_inBBox) {
|
||||
// Do not apply writeSummary at calls inside a task definition, or they will look like independent drivers (phantom MULTIDRIVEN).
|
||||
// did the lambda on purpose - lessen chance of screwup in future edits.
|
||||
//const auto inExecutedContext = [this]() const {
|
||||
// return !(m_taskp && !m_alwaysp && !m_inContAssign && !m_inInitialStatic && !m_inBBox);
|
||||
//};
|
||||
|
||||
const auto inExecutedContext = [this]() {
|
||||
return !(m_taskp && !m_alwaysp && !m_inContAssign && !m_inInitialStatic && !m_inBBox);
|
||||
};
|
||||
|
||||
if (!inExecutedContext()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -654,12 +654,12 @@ public:
|
|||
void V3Undriven::undrivenAll(AstNetlist* nodep) {
|
||||
UINFO(2, __FUNCTION__ << ":");
|
||||
// EOM
|
||||
//{ UndrivenVisitor{nodep}; }
|
||||
if (V3UndrivenCapture::enableWriteSummary) {
|
||||
const bool enable = V3UndrivenCapture::enableWriteSummary;
|
||||
if (enable) {
|
||||
V3UndrivenCapture capture{nodep};
|
||||
{ UndrivenVisitor{nodep, &capture, V3UndrivenCapture::enableWriteSummary}; }
|
||||
{ UndrivenVisitor{nodep, &capture, enable}; }
|
||||
} else {
|
||||
{ UndrivenVisitor{nodep, nullptr, V3UndrivenCapture::enableWriteSummary}; }
|
||||
{ UndrivenVisitor{nodep, nullptr, enable}; }
|
||||
}
|
||||
if (v3Global.opt.stats()) V3Stats::statsStage("undriven");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,14 +46,6 @@ class CaptureVisitor final : public VNVisitorConst {
|
|||
for (AstNode* np = nodep; np; np = np->nextp()) np->accept(v);
|
||||
}
|
||||
|
||||
/*
|
||||
V3UndrivenCapture::FTaskInfo& infoFor(const AstNodeFTask* taskp) {
|
||||
// Ensure entry exists
|
||||
return m_cap.writeSummary(taskp), const_cast<V3UndrivenCapture::FTaskInfo&>(
|
||||
*m_cap.find(taskp)); // not used; see below
|
||||
}
|
||||
*/
|
||||
|
||||
public:
|
||||
explicit CaptureVisitor(V3UndrivenCapture& cap, AstNetlist* netlistp)
|
||||
: m_cap{cap} {
|
||||
|
|
@ -67,7 +59,8 @@ private:
|
|||
m_curTaskp = nodep;
|
||||
++g_stats.ftasks;
|
||||
UINFO(DBG, "UndrivenCapture: enter ftask " << nodep << " " << nodep->prettyNameQ());
|
||||
(void)m_cap.ensureEntry(nodep); // ensure map entry exists
|
||||
//(void)m_cap.ensureEntry(nodep); // ensure map entry exists
|
||||
m_cap.info(nodep);
|
||||
iterateListConst(*this, nodep->stmtsp());
|
||||
}
|
||||
|
||||
|
|
@ -76,10 +69,11 @@ private:
|
|||
++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);
|
||||
//(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());
|
||||
//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);
|
||||
}
|
||||
|
|
@ -90,11 +84,14 @@ 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);
|
||||
//(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)
|
||||
|
||||
} else {
|
||||
UINFO(DBG, "UndrivenCapture: unresolved call in " << taskNameQ(m_curTaskp) << " name=" << nodep->name());
|
||||
}
|
||||
|
|
@ -202,4 +199,6 @@ void V3UndrivenCapture::debugDumpTask(FTask taskp, int level) const {
|
|||
<< " writeSummary=" << infop->writeSummary.size());
|
||||
}
|
||||
|
||||
void V3UndrivenCapture::ensureEntry(FTask taskp) { (void)m_info[taskp]; }
|
||||
//void V3UndrivenCapture::ensureEntry(FTask taskp) { (void)m_info[taskp]; }
|
||||
|
||||
V3UndrivenCapture::FTaskInfo& V3UndrivenCapture::info(FTask taskp) { return m_info[taskp]; }
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ public:
|
|||
|
||||
static bool enableWriteSummary;
|
||||
|
||||
// Get (and create if needed) mutable info entry for a task/function.
|
||||
FTaskInfo& info(FTask taskp);
|
||||
|
||||
private:
|
||||
// Per-task/function capture info keyed by resolved AstNodeFTask* identity.
|
||||
std::unordered_map<FTask, FTaskInfo> m_info;
|
||||
|
|
@ -71,7 +74,7 @@ public:
|
|||
const std::vector<Var>& writeSummary(FTask taskp);
|
||||
|
||||
// Ensure an entry exists for a task/function without computing its writeSummary.
|
||||
void ensureEntry(FTask taskp);
|
||||
//void ensureEntry(FTask taskp);
|
||||
|
||||
// Optional: dump one task's summary (for debug bring-up). You can omit if you prefer.
|
||||
void debugDumpTask(FTask taskp, int level = 9) const;
|
||||
|
|
|
|||
Loading…
Reference in New Issue