mirror of
https://github.com/verilator/verilator.git
synced 2026-09-07 10:01:11 +02:00
Fix Vdeeptemp error with --threads and --compiler clang (#3338).
This commit is contained in:
@@ -9185,6 +9185,13 @@ public:
|
||||
}
|
||||
AstNode* stmtsp() const { return op1p(); }
|
||||
void addStmtsp(AstNode* nodep) { addOp1p(nodep); }
|
||||
void addStmtsFirstp(AstNode* nodep) {
|
||||
if (stmtsp()) {
|
||||
stmtsp()->addHereThisAsNext(nodep);
|
||||
} else {
|
||||
addStmtsp(nodep);
|
||||
}
|
||||
}
|
||||
ExecMTask* execMTaskp() const { return m_execMTaskp; }
|
||||
void execMTaskp(ExecMTask* execMTaskp) { m_execMTaskp = execMTaskp; }
|
||||
virtual void dump(std::ostream& str = std::cout) const override;
|
||||
|
||||
+22
-2
@@ -41,6 +41,7 @@ private:
|
||||
|
||||
// STATE
|
||||
AstCFunc* m_cfuncp = nullptr; // Current block
|
||||
AstMTaskBody* m_mtaskbodyp = nullptr; // Current mtaskbody
|
||||
AstNode* m_stmtp = nullptr; // Current statement
|
||||
int m_depth = 0; // How deep in an expression
|
||||
int m_maxdepth = 0; // Maximum depth in an expression
|
||||
@@ -54,8 +55,13 @@ private:
|
||||
// if (debug() >= 9) nodep->dumpTree(cout, "deep:");
|
||||
AstVar* const varp = new AstVar{nodep->fileline(), VVarType::STMTTEMP,
|
||||
m_tempNames.get(nodep), nodep->dtypep()};
|
||||
UASSERT_OBJ(m_cfuncp, nodep, "Deep expression not under a function");
|
||||
m_cfuncp->addInitsp(varp);
|
||||
if (m_cfuncp) {
|
||||
m_cfuncp->addInitsp(varp);
|
||||
} else if (m_mtaskbodyp) {
|
||||
m_mtaskbodyp->addStmtsFirstp(varp);
|
||||
} else {
|
||||
nodep->v3fatalSrc("Deep expression not under a function");
|
||||
}
|
||||
// Replace node tree with reference to var
|
||||
AstVarRef* const newp = new AstVarRef{nodep->fileline(), varp, VAccess::READ};
|
||||
nodep->replaceWith(newp);
|
||||
@@ -71,14 +77,28 @@ private:
|
||||
// VISITORS
|
||||
virtual void visit(AstCFunc* nodep) override {
|
||||
VL_RESTORER(m_cfuncp);
|
||||
VL_RESTORER(m_mtaskbodyp);
|
||||
{
|
||||
m_cfuncp = nodep;
|
||||
m_mtaskbodyp = nullptr;
|
||||
m_depth = 0;
|
||||
m_maxdepth = 0;
|
||||
m_tempNames.reset();
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
virtual void visit(AstMTaskBody* nodep) override {
|
||||
VL_RESTORER(m_cfuncp);
|
||||
VL_RESTORER(m_mtaskbodyp);
|
||||
{
|
||||
m_cfuncp = nullptr;
|
||||
m_mtaskbodyp = nodep;
|
||||
m_depth = 0;
|
||||
m_maxdepth = 0;
|
||||
// We don't reset the names, as must share across tasks
|
||||
iterateChildren(nodep);
|
||||
}
|
||||
}
|
||||
void visitStmt(AstNodeStmt* nodep) {
|
||||
VL_RESTORER(m_stmtp);
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user