diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 3626bd9f9..917f794d5 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -804,7 +804,7 @@ void AstNode::checkTreeIter(AstNode* backp) { if (backp != this->backp()) { this->v3fatalSrc("Back node inconsistent"); } - if (castNodeTermop()) { + if (castNodeTermop() || castNodeVarRef()) { // Termops have a short-circuited iterateChildren, so check usage if (op1p()||op2p()||op3p()||op4p()) this->v3fatalSrc("Terminal operation with non-terminals"); diff --git a/src/V3Ast.h b/src/V3Ast.h index 1a5553753..170c1315b 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -823,6 +823,9 @@ struct AstNodeTermop : public AstNodeMath { AstNodeTermop(FileLine* fl) : AstNodeMath(fl) {} ASTNODE_BASE_FUNCS(NodeTermop) + // Know no children, and hot function, so skip iterator for speed + // See checkTreeIter also that asserts no children + void iterateChildren(AstNVisitor& v, AstNUser* vup=NULL) { } }; struct AstNodeUniop : public AstNodeMath { @@ -1070,6 +1073,9 @@ public: void hiername(const string& hn) { m_hiername = hn; } bool hierThis() const { return m_hierThis; } void hierThis(bool flag) { m_hierThis = flag; } + // Know no children, and hot function, so skip iterator for speed + // See checkTreeIter also that asserts no children + void iterateChildren(AstNVisitor& v, AstNUser* vup=NULL) { } }; class AstNodePli : public AstNodeStmt { diff --git a/src/V3AstNodes.h b/src/V3AstNodes.h index 93ae9e6ca..6ed8a7e2c 100644 --- a/src/V3AstNodes.h +++ b/src/V3AstNodes.h @@ -1675,11 +1675,12 @@ struct AstTime : public AstNodeTermop { virtual bool same(AstNode* samep) const { return true; } }; -struct AstUCFunc : public AstNodeTermop { +struct AstUCFunc : public AstNodeMath { // User's $c function + // Perhaps this should be a AstNodeListop; but there's only one list math right now public: AstUCFunc(FileLine* fl, AstNode* exprsp) - : AstNodeTermop(fl) { + : AstNodeMath(fl) { addNOp1p(exprsp); } ASTNODE_NODE_FUNCS(UCFunc, UCFUNC) diff --git a/src/V3Premit.cpp b/src/V3Premit.cpp index b16c0b8f2..56b2eb9c8 100644 --- a/src/V3Premit.cpp +++ b/src/V3Premit.cpp @@ -246,6 +246,8 @@ private: nodep->iterateChildren(*this); checkNode(nodep); } virtual void visit(AstNodeBiop* nodep, AstNUser*) { nodep->iterateChildren(*this); checkNode(nodep); } + virtual void visit(AstUCFunc* nodep, AstNUser*) { + nodep->iterateChildren(*this); checkNode(nodep); } virtual void visit(AstSel* nodep, AstNUser*) { nodep->fromp()->iterateAndNext(*this); { // Only the 'from' is part of the assignment LHS