diff --git a/src/V3Ast.cpp b/src/V3Ast.cpp index 5f63a0ae1..fa46b0994 100644 --- a/src/V3Ast.cpp +++ b/src/V3Ast.cpp @@ -758,13 +758,16 @@ void AstNode::iterateAndNext(AstNVisitor& v, AstNUser* vup) { // Future versions of this function may require the node to have a back to be iterated; // there's no lower level reason yet though the back must exist. AstNode* nodep=this; +#ifdef VL_DEBUG // Otherwise too hot of a function for debug if (VL_UNLIKELY(nodep && !nodep->m_backp)) nodep->v3fatalSrc("iterateAndNext node has no back"); +#endif while (nodep) { - AstNode* niterp = nodep; + AstNode* niterp = nodep; // This address may get stomped via m_iterpp if the node is edited ASTNODE_PREFETCH(nodep->m_nextp); niterp->m_iterpp = &niterp; niterp->accept(v, vup); // accept may do a replaceNode and change niterp on us... + //if (niterp != nodep) UINFO(1,"iterateAndNext edited "<<(void*)nodep<<" now into "<<(void*)niterp<m_iterpp = NULL; if (VL_UNLIKELY(niterp!=nodep)) { // Edited it diff --git a/src/V3Ast.h b/src/V3Ast.h index 547461ef4..2d6252bda 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -1144,7 +1144,7 @@ public: // AstAlways* castAlways(); }; -inline ostream& operator<<(ostream& os, AstNode* rhs) { rhs->dump(os); return os;} +inline ostream& operator<<(ostream& os, AstNode* rhs) { if (!rhs) os<<"NULL"; else rhs->dump(os); return os; } inline void AstNRelinker::relink(AstNode* newp) { newp->AstNode::relink(this); } //###################################################################### diff --git a/src/V3Width.cpp b/src/V3Width.cpp index 6c14875aa..9dedf9453 100644 --- a/src/V3Width.cpp +++ b/src/V3Width.cpp @@ -124,11 +124,7 @@ private: #define ANYSIZE 0 // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + static int debug() { return V3Width::debug(); } // VISITORS // Naming: width_O{outputtype}_L{lhstype}_R{rhstype}_W{widthing}_S{signing} @@ -2125,6 +2121,12 @@ public: //###################################################################### // Width class functions +int V3Width::debug() { + static int level = -1; + if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); + return level; +} + void V3Width::width(AstNetlist* nodep) { UINFO(2,__FUNCTION__<<": "<