diff --git a/src/V3Active.cpp b/src/V3Active.cpp index c01c76fa4..bf50c350c 100644 --- a/src/V3Active.cpp +++ b/src/V3Active.cpp @@ -52,11 +52,7 @@ class ActiveBaseVisitor : public AstNVisitor { protected: - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() }; class ActiveNamer : public ActiveBaseVisitor { diff --git a/src/V3ActiveTop.cpp b/src/V3ActiveTop.cpp index 27c367d73..99635202f 100644 --- a/src/V3ActiveTop.cpp +++ b/src/V3ActiveTop.cpp @@ -58,11 +58,7 @@ private: SenTreeFinder m_finder; // Find global sentree's and add them // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstTopScope* nodep) { diff --git a/src/V3AssertPre.cpp b/src/V3AssertPre.cpp index 39f2ea0f5..5a1a09e8f 100644 --- a/src/V3AssertPre.cpp +++ b/src/V3AssertPre.cpp @@ -49,11 +49,7 @@ private: AstNodeSenItem* m_senip; // Last sensitivity // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() AstSenTree* newSenTree(AstNode* nodep) { // Create sentree based on clocked or default clock diff --git a/src/V3Ast.h b/src/V3Ast.h index 150199025..6afdf7a2e 100644 --- a/src/V3Ast.h +++ b/src/V3Ast.h @@ -900,10 +900,12 @@ public: class AstNVisitor { private: + // MEMBERS std::vector m_deleteps; // Nodes to delete when doDeletes() called protected: friend class AstNode; public: + // METHODS /// At the end of the visitor (or doDeletes()), delete this pushed node /// along with all children and next(s). This is often better to use /// than an immediate deleteTree, as any pointers into this node will diff --git a/src/V3Begin.cpp b/src/V3Begin.cpp index 52d054e12..ba169d570 100644 --- a/src/V3Begin.cpp +++ b/src/V3Begin.cpp @@ -77,11 +77,7 @@ private: int m_ifDepth; // Current if depth // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstNodeModule* nodep) { diff --git a/src/V3Branch.cpp b/src/V3Branch.cpp index 34e80f590..bf51d7041 100644 --- a/src/V3Branch.cpp +++ b/src/V3Branch.cpp @@ -57,11 +57,7 @@ private: CFuncVec m_cfuncsp; // List of all tasks // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void reset() { m_likely = false; diff --git a/src/V3Case.cpp b/src/V3Case.cpp index 65c667fe7..0e9b1d498 100644 --- a/src/V3Case.cpp +++ b/src/V3Case.cpp @@ -59,11 +59,8 @@ class CaseLintVisitor : public AstNVisitor { private: AstNodeCase* m_caseExprp; // Under a CASE value node, if so the relevant case statement - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + // METHODS + VL_DEBUG_FUNC; // Declare debug() virtual void visit(AstNodeCase* nodep) { if (VN_IS(nodep, Case) && VN_CAST(nodep, Case)->casex()) { @@ -140,11 +137,7 @@ private: AstNode* m_valueItem[1<v3warn(IMPERFECTSCH,"Imperfect scheduling of variable: "<user1p()) return ((AstVarScope*)vscp->user1p()); diff --git a/src/V3Combine.cpp b/src/V3Combine.cpp index 629625c63..c49b30319 100644 --- a/src/V3Combine.cpp +++ b/src/V3Combine.cpp @@ -60,13 +60,8 @@ protected: // STATE // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } - virtual ~CombBaseVisitor() {} + VL_DEBUG_FUNC; // Declare debug() //***** optimization levels static bool emptyFunctionDeletion() { return true; } diff --git a/src/V3Const.cpp b/src/V3Const.cpp index ba97fd27e..e1a77be43 100644 --- a/src/V3Const.cpp +++ b/src/V3Const.cpp @@ -114,11 +114,7 @@ private: AstAttrOf* m_attrp; // Current attribute // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() bool operandConst (AstNode* nodep) { return VN_IS(nodep, Const); diff --git a/src/V3Coverage.cpp b/src/V3Coverage.cpp index c69264ec1..7aaff0b01 100644 --- a/src/V3Coverage.cpp +++ b/src/V3Coverage.cpp @@ -74,11 +74,7 @@ private: string m_beginHier; // AstBegin hier name for user coverage points // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() const char* varIgnoreToggle(AstVar* nodep) { // Return true if this shouldn't be traced diff --git a/src/V3CoverageJoin.cpp b/src/V3CoverageJoin.cpp index 52f82bdea..26f490b72 100644 --- a/src/V3CoverageJoin.cpp +++ b/src/V3CoverageJoin.cpp @@ -54,11 +54,7 @@ private: V3Double0 m_statToggleJoins; // Statistic tracking // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void detectDuplicates() { UINFO(9,"Finding duplicates\n"); diff --git a/src/V3Dead.cpp b/src/V3Dead.cpp index 705ec9c76..a22a6f66f 100644 --- a/src/V3Dead.cpp +++ b/src/V3Dead.cpp @@ -106,11 +106,7 @@ private: bool m_sideEffect; // Side effects discovered in assign RHS // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void checkAll(AstNode* nodep) { if (nodep != nodep->dtypep()) { // NodeDTypes reference themselves diff --git a/src/V3Delayed.cpp b/src/V3Delayed.cpp index 50feb034b..9fbe257c1 100644 --- a/src/V3Delayed.cpp +++ b/src/V3Delayed.cpp @@ -105,11 +105,7 @@ private: ScopeVecMap m_scopeVecMap; // Next var number for each scope // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void markVarUsage(AstVarScope* nodep, uint32_t flags) { //UINFO(4," MVU "< will work to control UINFOs in +/// that class: +#define VL_DEBUG_FUNC static int debug() { \ + static int level = -1; \ + if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); \ + return level; \ + } + //---------------------------------------------------------------------- template< class T> std::string cvtToStr (const T& t) { diff --git a/src/V3Expand.cpp b/src/V3Expand.cpp index feedb69bd..d03e6bf22 100644 --- a/src/V3Expand.cpp +++ b/src/V3Expand.cpp @@ -53,11 +53,7 @@ private: AstNode* m_stmtp; // Current statement // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() int longOrQuadWidth (AstNode* nodep) { // Return 32 or 64... diff --git a/src/V3File.cpp b/src/V3File.cpp index a98a79d12..7e832892a 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -316,11 +316,7 @@ class V3InFilterImp { private: // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() bool readContents(const string& filename, StrList& outl) { if (m_pid) return readContentsFilter(filename,outl); diff --git a/src/V3Gate.cpp b/src/V3Gate.cpp index 1f6e08034..374ce17cf 100644 --- a/src/V3Gate.cpp +++ b/src/V3Gate.cpp @@ -53,11 +53,7 @@ typedef std::list GateVarRefList; class GateBaseVisitor : public AstNVisitor { public: - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() }; //###################################################################### diff --git a/src/V3GenClk.cpp b/src/V3GenClk.cpp index e9f5a5fc8..5b769bebb 100644 --- a/src/V3GenClk.cpp +++ b/src/V3GenClk.cpp @@ -38,11 +38,7 @@ class GenClkBaseVisitor : public AstNVisitor { protected: - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() }; //###################################################################### diff --git a/src/V3Hashed.cpp b/src/V3Hashed.cpp index cb2a8a256..36d2fefb6 100644 --- a/src/V3Hashed.cpp +++ b/src/V3Hashed.cpp @@ -53,13 +53,9 @@ private: // STATE V3Hash m_lowerHash; // Hash of the statement we're building - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } - // METHODS + VL_DEBUG_FUNC; // Declare debug() + void nodeHashIterate(AstNode* nodep) { if (!nodep->user4()) { if (VN_IS(nodep->backp(), CFunc) diff --git a/src/V3Hashed.h b/src/V3Hashed.h index d6bf92279..7a2c157e5 100644 --- a/src/V3Hashed.h +++ b/src/V3Hashed.h @@ -36,11 +36,7 @@ public: ~VHashedBase() {} // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() }; //============================================================================ diff --git a/src/V3Inline.cpp b/src/V3Inline.cpp index 63b8a2dd7..c722f3370 100644 --- a/src/V3Inline.cpp +++ b/src/V3Inline.cpp @@ -84,11 +84,7 @@ private: std::map m_instances; // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void cantInline(const char* reason, bool hard) { if (hard) { if (m_modp->user2() != CIL_NOTHARD) { @@ -241,11 +237,8 @@ private: // Output: // AstCell::user4p() // AstCell* of the created clone - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + // METHODS + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstCell* nodep) { @@ -282,11 +275,8 @@ private: AstNodeModule* m_modp; // Current module AstCell* m_cellp; // Cell being cloned - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + // METHODS + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstCellInline* nodep) { @@ -499,11 +489,8 @@ private: AstNodeModule* m_modp; // Current module V3Double0 m_statCells; // Statistic tracking - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + // METHODS + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstNetlist* nodep) { diff --git a/src/V3Inst.cpp b/src/V3Inst.cpp index f57a54e11..18a9cdf56 100644 --- a/src/V3Inst.cpp +++ b/src/V3Inst.cpp @@ -51,12 +51,8 @@ private: // STATE AstCell* m_cellp; // Current cell - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } - //int m_debug; int debug() { return m_debug; } + // METHODS + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstCell* nodep) { @@ -153,11 +149,7 @@ private: typedef std::map VarNameMap; VarNameMap m_modVarNameMap; // Per module, name of cloned variables - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstVar* nodep) { @@ -215,11 +207,7 @@ private: typedef std::map VarNameMap; - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstVar* nodep) { @@ -466,11 +454,7 @@ public: class InstStatic { private: - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() InstStatic() {} // Static class static AstNode* extendOrSel(FileLine* fl, AstNode* rhsp, AstNode* cmpWidthp) { diff --git a/src/V3Life.cpp b/src/V3Life.cpp index 672e8290b..fc62446f7 100644 --- a/src/V3Life.cpp +++ b/src/V3Life.cpp @@ -135,11 +135,7 @@ class LifeBlock { LifeBlock* m_aboveLifep; // Upper life, or NULL LifeState* m_statep; // Current global state - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() public: LifeBlock(LifeBlock* aboveLifep, LifeState* statep) { @@ -297,11 +293,7 @@ private: LifeBlock* m_lifep; // Current active lifetime map for current scope // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstVarRef* nodep) { diff --git a/src/V3LifePost.cpp b/src/V3LifePost.cpp index a38cd53dd..29e146a83 100644 --- a/src/V3LifePost.cpp +++ b/src/V3LifePost.cpp @@ -44,11 +44,7 @@ class LifePostBaseVisitor : public AstNVisitor { protected: - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() }; //###################################################################### diff --git a/src/V3LinkCells.cpp b/src/V3LinkCells.cpp index 86733ad9c..e8ec640ca 100644 --- a/src/V3LinkCells.cpp +++ b/src/V3LinkCells.cpp @@ -113,11 +113,7 @@ private: V3GraphVertex* m_topVertexp; // Vertex of top module vl_unordered_set m_declfnWarned; // Files we issued DECLFILENAME on - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // METHODS V3GraphVertex* vertex(AstNodeModule* nodep) { diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index 2ef19cf87..44ff76aa4 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -128,11 +128,8 @@ private: public: - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + // METHODS + VL_DEBUG_FUNC; // Declare debug() void dump(const string& nameComment="linkdot", bool force=false) { if (debug()>=6 || force) { string filename = v3Global.debugFilename(nameComment)+".txt"; diff --git a/src/V3LinkJump.cpp b/src/V3LinkJump.cpp index a06ab7c74..c5b57b4ec 100644 --- a/src/V3LinkJump.cpp +++ b/src/V3LinkJump.cpp @@ -54,11 +54,7 @@ private: BeginStack m_beginStack; // All begin blocks above current node // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() AstJumpLabel* findAddLabel(AstNode* nodep, bool endOfIter) { // Put label under given node, and if WHILE optionally at end of iteration diff --git a/src/V3LinkLValue.cpp b/src/V3LinkLValue.cpp index 06a406765..2775e3731 100644 --- a/src/V3LinkLValue.cpp +++ b/src/V3LinkLValue.cpp @@ -47,11 +47,7 @@ private: AstNodeFTask* m_ftaskp; // Function or task we're inside // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITs // Result handing diff --git a/src/V3LinkParse.cpp b/src/V3LinkParse.cpp index f1f1920b9..2da4d1cec 100644 --- a/src/V3LinkParse.cpp +++ b/src/V3LinkParse.cpp @@ -65,11 +65,7 @@ private: AstNodeDType* m_dtypep; // Current data type // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void cleanFileline(AstNode* nodep) { if (!nodep->user2SetOnce()) { // Process once diff --git a/src/V3LinkResolve.cpp b/src/V3LinkResolve.cpp index ef5617e1b..8bdf3bc42 100644 --- a/src/V3LinkResolve.cpp +++ b/src/V3LinkResolve.cpp @@ -60,11 +60,7 @@ private: int m_senitemCvtNum; // Temporary signal counter // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITs // TODO: Most of these visitors are here for historical reasons. @@ -472,11 +468,7 @@ private: AstNodeModule* m_modp; // Current module // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITs virtual void visit(AstNetlist* nodep) { diff --git a/src/V3Localize.cpp b/src/V3Localize.cpp index b25c5017b..86fa7e26d 100644 --- a/src/V3Localize.cpp +++ b/src/V3Localize.cpp @@ -50,11 +50,7 @@ protected: // AstVar::user4() -> AstVarRef*. First place signal set; must be first assignment // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // TYPES union VarFlags { diff --git a/src/V3Name.cpp b/src/V3Name.cpp index c8ce7045f..85f41c6e6 100644 --- a/src/V3Name.cpp +++ b/src/V3Name.cpp @@ -52,11 +52,7 @@ private: V3LanguageWords m_words; // Reserved word detector // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void rename(AstNode* nodep, bool addPvt) { if (!nodep->user1()) { // Not already done diff --git a/src/V3Order.cpp b/src/V3Order.cpp index 5bbb5e74a..a5911d6a5 100644 --- a/src/V3Order.cpp +++ b/src/V3Order.cpp @@ -262,11 +262,7 @@ private: int m_rightClkWidth; // Clk width on the RHS // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() virtual void visit(AstNodeAssign* nodep) { m_hasClk = false; @@ -383,11 +379,7 @@ private: bool m_clkAss; // There is signals marked as clocker in the assignment // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() virtual void visit(AstNodeAssign* nodep) { if (const AstVarRef* varrefp = VN_CAST(nodep->lhsp(), VarRef) ) if (varrefp->varp()->attrClocker() == AstVarAttrClocker::CLOCKER_YES) { @@ -480,11 +472,7 @@ private: enum VarUsage { VU_NONE=0, VU_CON=1, VU_GEN=2 }; // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void iterateNewStmt(AstNode* nodep) { if (m_scopep) { diff --git a/src/V3Param.cpp b/src/V3Param.cpp index 434891e78..30ccf90bf 100644 --- a/src/V3Param.cpp +++ b/src/V3Param.cpp @@ -113,11 +113,7 @@ private: string m_unlinkedTxt; // Text for AstUnlinkedRef // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void makeSmallNames(AstNodeModule* modp) { std::vector usedLetter; usedLetter.resize(256); diff --git a/src/V3Premit.cpp b/src/V3Premit.cpp index acc26fa96..49b298f34 100644 --- a/src/V3Premit.cpp +++ b/src/V3Premit.cpp @@ -54,11 +54,7 @@ private: bool m_noopt; // Disable optimization of variables in this block // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstNodeAssign* nodep) { @@ -116,11 +112,7 @@ private: bool m_assignLhs; // Inside assignment lhs, don't breakup extracts // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() bool assignNoTemp(AstNodeAssign* nodep) { return (VN_IS(nodep->lhsp(), VarRef) diff --git a/src/V3Scope.cpp b/src/V3Scope.cpp index 73aafb34b..79667dd75 100644 --- a/src/V3Scope.cpp +++ b/src/V3Scope.cpp @@ -69,11 +69,7 @@ private: VarRefScopeSet m_varRefScopes; // Varrefs-in-scopes needing fixup when donw // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void cleanupVarRefs() { for (VarRefScopeSet::iterator it = m_varRefScopes.begin(); @@ -317,11 +313,7 @@ private: AstScope* m_scopep; // Current scope we are building // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITORS virtual void visit(AstScope* nodep) { diff --git a/src/V3SenTree.h b/src/V3SenTree.h index 44e8bb062..f27177819 100644 --- a/src/V3SenTree.h +++ b/src/V3SenTree.h @@ -56,11 +56,7 @@ private: std::vector m_treesp; // List of sensitive blocks, for folding // VISITORS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() virtual void visit(AstNodeModule* nodep) { // Only do the top diff --git a/src/V3Simulate.h b/src/V3Simulate.h index 112b9b8df..be873ff14 100644 --- a/src/V3Simulate.h +++ b/src/V3Simulate.h @@ -111,11 +111,7 @@ private: // Note level 8&9 include debugging each simulation value - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // Potentially very slow, intended for debugging string prettyNumber(V3Number* nump, AstNodeDType* dtypep) { diff --git a/src/V3Slice.cpp b/src/V3Slice.cpp index 8ed6e7ee9..fda8f3492 100644 --- a/src/V3Slice.cpp +++ b/src/V3Slice.cpp @@ -64,11 +64,7 @@ class SliceVisitor : public AstNVisitor { bool m_assignError; // True if the current assign already has an error // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() AstNode* cloneAndSel(AstNode* nodep, int elements, int offset) { // Insert an ArraySel, except for a few special cases diff --git a/src/V3Split.cpp b/src/V3Split.cpp index 479e98674..65e13ced0 100644 --- a/src/V3Split.cpp +++ b/src/V3Split.cpp @@ -277,11 +277,7 @@ public: // METHODS protected: - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void scoreboardClear() { //VV***** We reset user1p() and user2p on each block!!! @@ -680,11 +676,7 @@ protected: iterateChildren(nodep); } - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() private: VL_UNCOPYABLE(IfColorVisitor); }; @@ -741,11 +733,7 @@ public: } protected: - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() AstSplitPlaceholder* makePlaceholderp() { return new AstSplitPlaceholder(m_origAlwaysp->fileline()); diff --git a/src/V3SplitAs.cpp b/src/V3SplitAs.cpp index 714ea81f4..ce703b789 100644 --- a/src/V3SplitAs.cpp +++ b/src/V3SplitAs.cpp @@ -44,11 +44,7 @@ class SplitAsBaseVisitor : public AstNVisitor { public: // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() }; //###################################################################### diff --git a/src/V3Stats.cpp b/src/V3Stats.cpp index 9f2350adc..d42803840 100644 --- a/src/V3Stats.cpp +++ b/src/V3Stats.cpp @@ -68,11 +68,7 @@ private: V3Double0 m_statVarScpBytes; // Statistic tracking // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void allNodes(AstNode* nodep) { m_instrs += nodep->instrCount(); diff --git a/src/V3Subst.cpp b/src/V3Subst.cpp index 778c9bc75..918208331 100644 --- a/src/V3Subst.cpp +++ b/src/V3Subst.cpp @@ -45,11 +45,7 @@ class SubstBaseVisitor : public AstNVisitor { public: - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() }; //###################################################################### diff --git a/src/V3Table.cpp b/src/V3Table.cpp index 307696fd0..b382927d5 100644 --- a/src/V3Table.cpp +++ b/src/V3Table.cpp @@ -98,11 +98,7 @@ private: std::deque m_tableVarps; // Table being created // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() bool treeTest(AstAlways* nodep) { // Process alw/assign tree diff --git a/src/V3Task.cpp b/src/V3Task.cpp index 0c7c262c1..92fa75479 100644 --- a/src/V3Task.cpp +++ b/src/V3Task.cpp @@ -318,11 +318,7 @@ private: DpiNames m_dpiNames; // Map of all created DPI functions // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() AstVarScope* createFuncVar(AstCFunc* funcp, const string& name, AstVar* examplep) { AstVar* newvarp = new AstVar (funcp->fileline(), AstVarType::BLOCKTEMP, name, diff --git a/src/V3Trace.cpp b/src/V3Trace.cpp index bf3e1c876..c5f2051e2 100644 --- a/src/V3Trace.cpp +++ b/src/V3Trace.cpp @@ -190,11 +190,7 @@ private: V3Double0 m_statUniqCodes;// Statistic tracking // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void detectDuplicates() { UINFO(9,"Finding duplicates\n"); diff --git a/src/V3TraceDecl.cpp b/src/V3TraceDecl.cpp index 22e49da61..256133592 100644 --- a/src/V3TraceDecl.cpp +++ b/src/V3TraceDecl.cpp @@ -58,11 +58,7 @@ private: V3Double0 m_statIgnSigs; // Statistic tracking // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() const char* vscIgnoreTrace(AstVarScope* nodep) { // Return true if this shouldn't be traced diff --git a/src/V3Tristate.cpp b/src/V3Tristate.cpp index 948f080c8..e9ea04fbc 100644 --- a/src/V3Tristate.cpp +++ b/src/V3Tristate.cpp @@ -79,11 +79,7 @@ class TristateBaseVisitor : public AstNVisitor { public: // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() }; //###################################################################### @@ -142,11 +138,7 @@ public: private: // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() TristateVertex* makeVertex(AstNode* nodep) { TristateVertex* vertexp = (TristateVertex*)(nodep->user5p()); diff --git a/src/V3Undriven.cpp b/src/V3Undriven.cpp index 0dacfd4df..b21413072 100644 --- a/src/V3Undriven.cpp +++ b/src/V3Undriven.cpp @@ -52,11 +52,7 @@ class UndrivenVarEntry { enum { FLAG_USED = 0, FLAG_DRIVEN = 1, FLAGS_PER_BIT = 2 }; - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() public: // CONSTRUCTORS @@ -241,11 +237,7 @@ private: AstAlways* m_alwaysp; // Current always if combo, otherwise NULL // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() UndrivenVarEntry* getEntryp(AstVar* nodep, int which_user) { if (!(which_user==1 ? nodep->user1p() : nodep->user2p())) { diff --git a/src/V3Unknown.cpp b/src/V3Unknown.cpp index 58ea445a3..bfaacc1e1 100644 --- a/src/V3Unknown.cpp +++ b/src/V3Unknown.cpp @@ -64,11 +64,7 @@ private: AstAssignDly* m_assigndlyp; // Current assignment // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void replaceBoundLvalue(AstNode* nodep, AstNode* condp) { // Spec says a out-of-range LHS SEL results in a NOP. diff --git a/src/V3Unroll.cpp b/src/V3Unroll.cpp index ffda7232f..05769e205 100644 --- a/src/V3Unroll.cpp +++ b/src/V3Unroll.cpp @@ -61,11 +61,7 @@ private: V3Double0 m_statIters; // Statistic tracking // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() // VISITORS bool cantUnroll(AstNode* nodep, const char* reason) { diff --git a/src/V3WidthSel.cpp b/src/V3WidthSel.cpp index 06f9dface..e56fe31fe 100644 --- a/src/V3WidthSel.cpp +++ b/src/V3WidthSel.cpp @@ -53,11 +53,7 @@ private: #define iterateChildren DO_NOT_iterateChildern_IN_V3WidthSel // METHODS - static int debug() { - static int level = -1; - if (VL_UNLIKELY(level < 0)) level = v3Global.opt.debugSrcLevel(__FILE__); - return level; - } + VL_DEBUG_FUNC; // Declare debug() void checkConstantOrReplace(AstNode* nodep, const string& message) { // See also V3Width::checkConstantOrReplace