Rework multithreading handling to separate by code units that use/never use it. (#4228)

This commit is contained in:
Mariusz Glebocki 2023-09-25 04:12:23 +02:00 committed by GitHub
parent d64c023099
commit 28bd7e5b19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
210 changed files with 1365 additions and 913 deletions

View File

@ -389,7 +389,7 @@ HEADER_CC_H := $(filter-out $(NON_STANDALONE_HEADERS), $(notdir $(wildcard $(src
header_cc: $(addsuffix __header_cc.o, $(basename $(HEADER_CC_H)))
%__header_cc.cpp: %.h
$(PYTHON3) $(srcdir)/../bin/verilator_includer $^ > $@
$(PYTHON3) $(srcdir)/../bin/verilator_includer -DVL_MT_DISABLED_CODE_UNIT=1 $^ > $@
.SUFFIXES:

View File

@ -26,6 +26,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Active final {
public:
static void activeAll(AstNetlist* nodep);
static void activeAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -23,6 +23,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3ActiveTop final {
public:
static void activeTopAll(AstNetlist* nodep);
static void activeTopAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -21,12 +21,13 @@
#include "verilatedos.h"
#include "V3Ast.h"
#include "V3ThreadSafety.h"
//============================================================================
class V3Assert final {
public:
static void assertAll(AstNetlist* nodep);
static void assertAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -19,6 +19,8 @@
// Transform clocking blocks into imperative logic
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3AssertPre final {
public:
static void assertPreAll(AstNetlist* nodep);
static void assertPreAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -1034,7 +1034,7 @@ class AstExecGraph final : public AstNode {
const string m_name; // Name of this AstExecGraph (for uniqueness at code generation)
public:
explicit AstExecGraph(FileLine* fl, const string& name);
explicit AstExecGraph(FileLine* fl, const string& name) VL_MT_DISABLED;
ASTGEN_MEMBERS_AstExecGraph;
~AstExecGraph() override;
const char* broken() const override {

View File

@ -357,10 +357,10 @@ AstNodeBiop* AstEqWild::newTyped(FileLine* fl, AstNodeExpr* lhsp, AstNodeExpr* r
}
}
AstExecGraph::AstExecGraph(FileLine* fileline, const string& name)
: ASTGEN_SUPER_ExecGraph(fileline)
, m_depGraphp{new V3Graph}
, m_name{name} {}
AstExecGraph::AstExecGraph(FileLine* fileline, const string& name) VL_MT_DISABLED
: ASTGEN_SUPER_ExecGraph(fileline),
m_depGraphp{new V3Graph},
m_name{name} {}
AstExecGraph::~AstExecGraph() { VL_DO_DANGLING(delete m_depGraphp, m_depGraphp); }

View File

@ -26,6 +26,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Begin final {
public:
static void debeginAll(AstNetlist* nodep);
static void debeginAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -23,6 +23,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,6 +20,8 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
@ -27,7 +29,7 @@ class AstNetlist;
class V3Branch final {
public:
// CONSTRUCTORS
static void branchAll(AstNetlist* nodep);
static void branchAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -24,6 +24,8 @@
// This transformation honors outputSplitCFuncs.
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,14 +20,16 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
//============================================================================
class V3CCtors final {
public:
static void cctorsAll();
static void cctorsAll() VL_MT_DISABLED;
private:
static void evalAsserts();
static void evalAsserts() VL_MT_DISABLED;
};
#endif // Guard

View File

@ -22,6 +22,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,11 +20,13 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
//============================================================================
class V3CUse final {
public:
static void cUseAll();
static void cUseAll() VL_MT_DISABLED;
};
#endif // Guard

View File

@ -34,6 +34,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,6 +20,8 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
class AstNodeCase;
@ -27,8 +29,8 @@ class AstNodeCase;
class V3Case final {
public:
static void caseAll(AstNetlist* nodep);
static void caseLint(AstNodeCase* nodep);
static void caseAll(AstNetlist* nodep) VL_MT_DISABLED;
static void caseLint(AstNodeCase* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -37,6 +37,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Cast final {
public:
static void castAll(AstNetlist* nodep);
static void castAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -20,6 +20,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Class final {
public:
static void classAll(AstNetlist* nodep);
static void classAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -23,6 +23,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Clean final {
public:
static void cleanAll(AstNetlist* nodep);
static void cleanAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -27,6 +27,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Clock final {
public:
static void clockAll(AstNetlist* nodep);
static void clockAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -19,6 +19,8 @@
// Also drop empty CFuncs
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Combine final {
public:
static void combineAll(AstNetlist* nodep);
static void combineAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -20,6 +20,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,11 +20,13 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
//============================================================================
class V3Common final {
public:
static void commonAll();
static void commonAll() VL_MT_DISABLED;
};
#endif // Guard

View File

@ -20,6 +20,8 @@
// If operands are constant, replace this node with constant.
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -21,43 +21,44 @@
#include "verilatedos.h"
#include "V3Ast.h"
#include "V3ThreadSafety.h"
//============================================================================
class V3Const final {
public:
static AstNode* constifyParamsEdit(AstNode* nodep);
static AstNodeExpr* constifyParamsEdit(AstNodeExpr* exprp) {
static AstNode* constifyParamsEdit(AstNode* nodep) VL_MT_DISABLED;
static AstNodeExpr* constifyParamsEdit(AstNodeExpr* exprp) VL_MT_DISABLED {
return VN_AS(constifyParamsEdit(static_cast<AstNode*>(exprp)), NodeExpr);
}
static AstNode* constifyParamsNoWarnEdit(AstNode* nodep);
static AstNodeExpr* constifyParamsNoWarnEdit(AstNodeExpr* exprp) {
static AstNode* constifyParamsNoWarnEdit(AstNode* nodep) VL_MT_DISABLED;
static AstNodeExpr* constifyParamsNoWarnEdit(AstNodeExpr* exprp) VL_MT_DISABLED {
return VN_AS(constifyParamsNoWarnEdit(static_cast<AstNode*>(exprp)), NodeExpr);
}
static AstNode* constifyGenerateParamsEdit(AstNode* nodep);
static AstNode* constifyGenerateParamsEdit(AstNode* nodep) VL_MT_DISABLED;
// Only do constant pushing, without removing dead logic
static void constifyAllLive(AstNetlist* nodep);
static void constifyAllLive(AstNetlist* nodep) VL_MT_DISABLED;
// Everything that's possible
static void constifyAll(AstNetlist* nodep);
static void constifyAll(AstNetlist* nodep) VL_MT_DISABLED;
// Also, warn
static void constifyAllLint(AstNetlist* nodep);
static void constifyAllLint(AstNetlist* nodep) VL_MT_DISABLED;
// C++ datatypes
static void constifyCpp(AstNetlist* nodep);
static void constifyCpp(AstNetlist* nodep) VL_MT_DISABLED;
// Only the current node and lower
// Return new node that may have replaced nodep
static AstNode* constifyEditCpp(AstNode* nodep);
static AstNodeExpr* constifyEditCpp(AstNodeExpr* exprp) {
static AstNode* constifyEditCpp(AstNode* nodep) VL_MT_DISABLED;
static AstNodeExpr* constifyEditCpp(AstNodeExpr* exprp) VL_MT_DISABLED {
return VN_AS(constifyEditCpp(static_cast<AstNode*>(exprp)), NodeExpr);
}
// Only the current node and lower
// Return new node that may have replaced nodep
static AstNode* constifyEdit(AstNode* nodep);
static AstNodeExpr* constifyEdit(AstNodeExpr* exprp) {
static AstNode* constifyEdit(AstNode* nodep) VL_MT_DISABLED;
static AstNodeExpr* constifyEdit(AstNodeExpr* exprp) VL_MT_DISABLED {
return VN_AS(constifyEdit(static_cast<AstNode*>(exprp)), NodeExpr);
}
// Only the current node and lower, with special SenTree optimization
// Return new node that may have replaced nodep
static AstNode* constifyExpensiveEdit(AstNode* nodep);
static AstNode* constifyExpensiveEdit(AstNode* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -24,6 +24,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,6 +20,8 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
@ -27,7 +29,7 @@ class AstNetlist;
class V3Coverage final {
public:
// CONSTRUCTORS
static void coverage(AstNetlist* rootp);
static void coverage(AstNetlist* rootp) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -17,6 +17,8 @@
// If two COVERTOGGLEs have same VARSCOPE, combine them
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,6 +20,8 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
@ -27,7 +29,7 @@ class AstNetlist;
class V3CoverageJoin final {
public:
// CONSTRUCTORS
static void coverageJoin(AstNetlist* rootp);
static void coverageJoin(AstNetlist* rootp) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -33,6 +33,8 @@
// here after scoping to allow more dead node removal.
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,6 +20,8 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
@ -27,13 +29,13 @@ class AstNetlist;
class V3Dead final {
public:
// Modules, no vars/dtypes
static void deadifyModules(AstNetlist* nodep);
static void deadifyModules(AstNetlist* nodep) VL_MT_DISABLED;
// Modules, Data types
static void deadifyDTypes(AstNetlist* nodep);
static void deadifyDTypesScoped(AstNetlist* nodep);
static void deadifyDTypes(AstNetlist* nodep) VL_MT_DISABLED;
static void deadifyDTypesScoped(AstNetlist* nodep) VL_MT_DISABLED;
// Everything that's possible
static void deadifyAll(AstNetlist* nodep);
static void deadifyAllScoped(AstNetlist* nodep);
static void deadifyAll(AstNetlist* nodep) VL_MT_DISABLED;
static void deadifyAllScoped(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -48,6 +48,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Delayed final {
public:
static void delayedAll(AstNetlist* nodep);
static void delayedAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -23,6 +23,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Depth final {
public:
static void depthAll(AstNetlist* nodep);
static void depthAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -20,6 +20,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3DepthBlock final {
public:
static void depthBlockAll(AstNetlist* nodep);
static void depthBlockAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -22,6 +22,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Descope final {
public:
static void descopeAll(AstNetlist* nodep);
static void descopeAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -35,8 +35,10 @@
#include "V3Ast.h"
#include "V3Error.h"
#include "V3Global.h"
#include "V3Hash.h"
#include "V3List.h"
#include "V3ThreadSafety.h"
#include "V3Dfg__gen_forward_class_decls.h" // From ./astgen
@ -140,8 +142,8 @@ class DfgGraph final {
public:
// CONSTRUCTOR
explicit DfgGraph(AstModule& module, const string& name = "");
~DfgGraph();
explicit DfgGraph(AstModule& module, const string& name = "") VL_MT_DISABLED;
~DfgGraph() VL_MT_DISABLED;
VL_UNCOPYABLE(DfgGraph);
// METHODS
@ -183,12 +185,12 @@ public:
inline void forEachVertex(std::function<void(const DfgVertex&)> f) const;
// Add contents of other graph to this graph. Leaves other graph empty.
void addGraph(DfgGraph& other);
void addGraph(DfgGraph& other) VL_MT_DISABLED;
// Split this graph into individual components (unique sub-graphs with no edges between them).
// Also removes any vertices that are not weakly connected to any variable.
// Leaves 'this' graph empty.
std::vector<std::unique_ptr<DfgGraph>> splitIntoComponents(std::string label);
std::vector<std::unique_ptr<DfgGraph>> splitIntoComponents(std::string label) VL_MT_DISABLED;
// Extract cyclic sub-graphs from 'this' graph. Cyclic sub-graphs are those that contain at
// least one strongly connected component (SCC) plus any other vertices that feed or sink from
@ -198,26 +200,27 @@ public:
// of a cycle) are left in 'this' graph. This means that at the end 'this' graph is guaranteed
// to be a DAG (acyclic). 'this' will not necessarily be a connected graph at the end, even if
// it was originally connected.
std::vector<std::unique_ptr<DfgGraph>> extractCyclicComponents(std::string label);
std::vector<std::unique_ptr<DfgGraph>>
extractCyclicComponents(std::string label) VL_MT_DISABLED;
// Dump graph in Graphviz format into the given stream 'os'. 'label' is added to the name of
// the graph which is included in the output.
void dumpDot(std::ostream& os, const string& label = "") const;
void dumpDot(std::ostream& os, const string& label = "") const VL_MT_DISABLED;
// Dump graph in Graphviz format into a new file with the given 'fileName'. 'label' is added to
// the name of the graph which is included in the output.
void dumpDotFile(const string& fileName, const string& label = "") const;
void dumpDotFile(const string& fileName, const string& label = "") const VL_MT_DISABLED;
// Dump graph in Graphviz format into a new automatically numbered debug file. 'label' is
// added to the name of the graph, which is included in the file name and the output.
void dumpDotFilePrefixed(const string& label = "") const;
void dumpDotFilePrefixed(const string& label = "") const VL_MT_DISABLED;
// Dump upstream (source) logic cone starting from given vertex into a file with the given
// 'fileName'. 'name' is the name of the graph, which is included in the output.
void dumpDotUpstreamCone(const string& fileName, const DfgVertex& vtx,
const string& name = "") const;
const string& name = "") const VL_MT_DISABLED;
// Dump all individual logic cones driving external variables in Graphviz format into separate
// new automatically numbered debug files. 'label' is added to the name of the graph, which is
// included in the file names and the output. This is useful for very large graphs that are
// otherwise difficult to browse visually due to their size.
void dumpDotAllVarConesPrefixed(const string& label = "") const;
void dumpDotAllVarConesPrefixed(const string& label = "") const VL_MT_DISABLED;
};
//------------------------------------------------------------------------------
@ -243,9 +246,9 @@ public:
// The sink (consumer) of this edge
DfgVertex* sinkp() const { return m_sinkp; }
// Remove driver of this edge
void unlinkSource();
void unlinkSource() VL_MT_DISABLED;
// Relink this edge to be driven from the given new source vertex
void relinkSource(DfgVertex* newSourcep);
void relinkSource(DfgVertex* newSourcep) VL_MT_DISABLED;
};
//------------------------------------------------------------------------------
@ -272,10 +275,10 @@ protected:
UserDataStorage m_userDataStorage; // User data storage
// CONSTRUCTOR
DfgVertex(DfgGraph& dfg, VDfgType type, FileLine* flp, AstNodeDType* dtypep);
DfgVertex(DfgGraph& dfg, VDfgType type, FileLine* flp, AstNodeDType* dtypep) VL_MT_DISABLED;
public:
virtual ~DfgVertex();
virtual ~DfgVertex() VL_MT_DISABLED;
// METHODS
private:
@ -283,10 +286,10 @@ private:
virtual void accept(DfgVisitor& v) = 0;
// Part of Vertex equality only dependent on this vertex
virtual bool selfEquals(const DfgVertex& that) const;
virtual bool selfEquals(const DfgVertex& that) const VL_MT_DISABLED;
// Part of Vertex hash only dependent on this vertex
virtual V3Hash selfHash() const;
virtual V3Hash selfHash() const VL_MT_DISABLED;
public:
// Supported packed types
@ -409,7 +412,7 @@ public:
// semantics of the logic. The 'cache' argument is used to store results to avoid repeat
// evaluations, but it requires that the upstream sources of the compared vertices do not
// change between invocations.
bool equals(const DfgVertex& that, EqualsCache& cache) const;
bool equals(const DfgVertex& that, EqualsCache& cache) const VL_MT_DISABLED;
// Uncached version of 'equals'
bool equals(const DfgVertex& that) const {
@ -419,7 +422,7 @@ public:
// Hash of vertex (depends on this vertex and all upstream vertices feeding into this vertex).
// Uses user data for caching hashes
V3Hash hash();
V3Hash hash() VL_MT_DISABLED;
// Source edges of this vertex
virtual std::pair<DfgEdge*, size_t> sourceEdges() = 0;
@ -437,13 +440,13 @@ public:
bool hasMultipleSinks() const { return m_sinksp && m_sinksp->m_nextp; }
// Fanout (number of sinks) of this vertex (expensive to compute)
uint32_t fanout() const;
uint32_t fanout() const VL_MT_DISABLED;
// Unlink from container (graph or builder), then delete this vertex
void unlinkDelete(DfgGraph& dfg);
void unlinkDelete(DfgGraph& dfg) VL_MT_DISABLED;
// Relink all sinks to be driven from the given new source
void replaceWith(DfgVertex* newSourcep);
void replaceWith(DfgVertex* newSourcep) VL_MT_DISABLED;
// Access to vertex list for faster iteration in important contexts
DfgVertex* verticesNext() const { return m_verticesEnt.nextp(); }
@ -451,56 +454,58 @@ public:
// Calls given function 'f' for each source vertex of this vertex
// Unconnected source edges are not iterated.
inline void forEachSource(std::function<void(DfgVertex&)> f);
inline void forEachSource(std::function<void(DfgVertex&)> f) VL_MT_DISABLED;
// Calls given function 'f' for each source vertex of this vertex
// Unconnected source edges are not iterated.
inline void forEachSource(std::function<void(const DfgVertex&)> f) const;
inline void forEachSource(std::function<void(const DfgVertex&)> f) const VL_MT_DISABLED;
// Calls given function 'f' for each source edge of this vertex. Also passes source index.
inline void forEachSourceEdge(std::function<void(DfgEdge&, size_t)> f);
inline void forEachSourceEdge(std::function<void(DfgEdge&, size_t)> f) VL_MT_DISABLED;
// Calls given function 'f' for each source edge of this vertex. Also passes source index.
inline void forEachSourceEdge(std::function<void(const DfgEdge&, size_t)> f) const;
inline void
forEachSourceEdge(std::function<void(const DfgEdge&, size_t)> f) const VL_MT_DISABLED;
// Calls given function 'f' for each sink vertex of this vertex
// Unlinking/deleting the given sink during iteration is safe, but not other sinks of this
// vertex.
inline void forEachSink(std::function<void(DfgVertex&)> f);
inline void forEachSink(std::function<void(DfgVertex&)> f) VL_MT_DISABLED;
// Calls given function 'f' for each sink vertex of this vertex
inline void forEachSink(std::function<void(const DfgVertex&)> f) const;
inline void forEachSink(std::function<void(const DfgVertex&)> f) const VL_MT_DISABLED;
// Calls given function 'f' for each sink edge of this vertex.
// Unlinking/deleting the given sink during iteration is safe, but not other sinks of this
// vertex.
inline void forEachSinkEdge(std::function<void(DfgEdge&)> f);
inline void forEachSinkEdge(std::function<void(DfgEdge&)> f) VL_MT_DISABLED;
// Calls given function 'f' for each sink edge of this vertex.
inline void forEachSinkEdge(std::function<void(const DfgEdge&)> f) const;
inline void forEachSinkEdge(std::function<void(const DfgEdge&)> f) const VL_MT_DISABLED;
// Returns first source edge which satisfies the given predicate 'p', or nullptr if no such
// sink vertex exists
inline const DfgEdge* findSourceEdge(std::function<bool(const DfgEdge&, size_t)> p) const;
inline const DfgEdge*
findSourceEdge(std::function<bool(const DfgEdge&, size_t)> p) const VL_MT_DISABLED;
// Returns first sink vertex of type 'Vertex' which satisfies the given predicate 'p',
// or nullptr if no such sink vertex exists
template <typename Vertex>
inline Vertex* findSink(std::function<bool(const Vertex&)> p) const;
inline Vertex* findSink(std::function<bool(const Vertex&)> p) const VL_MT_DISABLED;
// Returns first sink vertex of type 'Vertex', or nullptr if no such sink vertex exists.
// This is a special case of 'findSink' above with the predicate always true.
template <typename Vertex>
inline Vertex* findSink() const;
inline Vertex* findSink() const VL_MT_DISABLED;
// Is this a DfgConst that is all zeroes
inline bool isZero() const;
inline bool isZero() const VL_MT_DISABLED;
// Is this a DfgConst that is all ones
inline bool isOnes() const;
inline bool isOnes() const VL_MT_DISABLED;
// Should this vertex be inlined when rendering to Ast, or be stored to a temporary
inline bool inlined() const;
inline bool inlined() const VL_MT_DISABLED;
// Methods that allow DfgVertex to participate in error reporting/messaging
void v3errorEnd(std::ostringstream& str) const VL_RELEASE(V3Error::s().m_mutex) {

View File

@ -26,6 +26,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -18,6 +18,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -26,6 +26,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -18,6 +18,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -21,15 +21,16 @@
#include "verilatedos.h"
#include "V3Ast.h"
#include "V3ThreadSafety.h"
//============================================================================
namespace V3DfgOptimizer {
// Extract further logic blocks from the design for additional optimization opportunities
void extract(AstNetlist*);
void extract(AstNetlist*) VL_MT_DISABLED;
// Optimize the design
void optimize(AstNetlist*, const string& label);
void optimize(AstNetlist*, const string& label) VL_MT_DISABLED;
} // namespace V3DfgOptimizer
#endif // Guard

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "V3DfgPasses.h"

View File

@ -20,6 +20,7 @@
#include "config_build.h"
#include "V3DfgPeephole.h"
#include "V3ThreadSafety.h"
class AstModule;
class DfgGraph;
@ -35,7 +36,7 @@ public:
VDouble0 m_eliminated; // Number of common sub-expressions eliminated
explicit V3DfgCseContext(const std::string& label)
: m_label{label} {}
~V3DfgCseContext();
~V3DfgCseContext() VL_MT_DISABLED;
};
class DfgRemoveVarsContext final {
@ -45,7 +46,7 @@ public:
VDouble0 m_removed; // Number of redundant variables removed
explicit DfgRemoveVarsContext(const std::string& label)
: m_label{label} {}
~DfgRemoveVarsContext();
~DfgRemoveVarsContext() VL_MT_DISABLED;
};
class V3DfgOptimizationContext final {
@ -73,8 +74,8 @@ public:
V3DfgCseContext m_cseContext1{m_label + " 2nd"};
V3DfgPeepholeContext m_peepholeContext{m_label};
DfgRemoveVarsContext m_removeVarsContext{m_label};
explicit V3DfgOptimizationContext(const std::string& label);
~V3DfgOptimizationContext();
explicit V3DfgOptimizationContext(const std::string& label) VL_MT_DISABLED;
~V3DfgOptimizationContext() VL_MT_DISABLED;
const std::string& prefix() const { return m_prefix; }
};
@ -87,29 +88,29 @@ namespace V3DfgPasses {
// Construct a DfGGraph representing the combinational logic in the given AstModule. The logic
// that is represented by the graph is removed from the given AstModule. Returns the
// constructed DfgGraph.
DfgGraph* astToDfg(AstModule&, V3DfgOptimizationContext&);
DfgGraph* astToDfg(AstModule&, V3DfgOptimizationContext&) VL_MT_DISABLED;
// Optimize the given DfgGraph
void optimize(DfgGraph&, V3DfgOptimizationContext&);
void optimize(DfgGraph&, V3DfgOptimizationContext&) VL_MT_DISABLED;
// Convert DfgGraph back into Ast, and insert converted graph back into its parent module.
// Returns the parent module.
AstModule* dfgToAst(DfgGraph&, V3DfgOptimizationContext&);
AstModule* dfgToAst(DfgGraph&, V3DfgOptimizationContext&) VL_MT_DISABLED;
//===========================================================================
// Intermediate/internal operations
//===========================================================================
// Common subexpression elimination
void cse(DfgGraph&, V3DfgCseContext&);
void cse(DfgGraph&, V3DfgCseContext&) VL_MT_DISABLED;
// Inline fully driven variables
void inlineVars(const DfgGraph&);
void inlineVars(const DfgGraph&) VL_MT_DISABLED;
// Peephole optimizations
void peephole(DfgGraph&, V3DfgPeepholeContext&);
void peephole(DfgGraph&, V3DfgPeepholeContext&) VL_MT_DISABLED;
// Remove redundant variables
void removeVars(DfgGraph&, DfgRemoveVarsContext&);
void removeVars(DfgGraph&, DfgRemoveVarsContext&) VL_MT_DISABLED;
// Remove unused nodes
void removeUnused(DfgGraph&);
void removeUnused(DfgGraph&) VL_MT_DISABLED;
} // namespace V3DfgPasses
#endif

View File

@ -21,6 +21,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "V3DfgPeephole.h"

View File

@ -19,6 +19,8 @@
#include "config_build.h"
#include "V3ThreadSafety.h"
#include <V3Stats.h>
#define _FOR_EACH_DFG_PEEPHOLE_OPTIMIZATION_APPLY(macro, arg) macro(arg, #arg)
@ -127,8 +129,8 @@ struct V3DfgPeepholeContext final {
// Count of applications for each optimization (for statistics)
std::array<VDouble0, VDfgPeepholePattern::_ENUM_END> m_count;
explicit V3DfgPeepholeContext(const std::string& label);
~V3DfgPeepholeContext();
explicit V3DfgPeepholeContext(const std::string& label) VL_MT_DISABLED;
~V3DfgPeepholeContext() VL_MT_DISABLED;
};
#endif

View File

@ -43,8 +43,8 @@ class DfgVertexVar VL_NOT_FINAL : public DfgVertexVariadic {
bool m_hasModRefs = false; // This AstVar is referenced outside the DFG, but in the module
bool m_hasExtRefs = false; // This AstVar is referenced from outside the module
bool selfEquals(const DfgVertex& that) const final;
V3Hash selfHash() const final;
bool selfEquals(const DfgVertex& that) const final VL_MT_DISABLED;
V3Hash selfHash() const final VL_MT_DISABLED;
public:
DfgVertexVar(DfgGraph& dfg, VDfgType type, AstVar* varp, uint32_t initialCapacity)
@ -92,8 +92,8 @@ class DfgConst final : public DfgVertex {
V3Number m_num; // Constant value
bool selfEquals(const DfgVertex& that) const override;
V3Hash selfHash() const override;
bool selfEquals(const DfgVertex& that) const override VL_MT_DISABLED;
V3Hash selfHash() const override VL_MT_DISABLED;
public:
DfgConst(DfgGraph& dfg, FileLine* flp, const V3Number& num)
@ -158,8 +158,8 @@ class DfgSel final : public DfgVertexUnary {
// the constant 'lsbp', and as 'DfgMux` for the non-constant 'lsbp'.
uint32_t m_lsb = 0; // The LSB index
bool selfEquals(const DfgVertex& that) const override;
V3Hash selfHash() const override;
bool selfEquals(const DfgVertex& that) const override VL_MT_DISABLED;
V3Hash selfHash() const override VL_MT_DISABLED;
public:
DfgSel(DfgGraph& dfg, FileLine* flp, AstNodeDType* dtypep)

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -26,6 +26,7 @@
#include "V3Ast.h"
#include "V3Error.h"
#include "V3Hasher.h"
#include "V3ThreadSafety.h"
#include <map>
#include <memory>
@ -76,14 +77,14 @@ public:
iterator insert(AstNode* nodep) { return emplace(m_hasher(nodep), nodep); }
// Erase node from data structure
size_type erase(AstNode* nodep);
size_type erase(AstNode* nodep) VL_MT_DISABLED;
// Return duplicate, if one was inserted, with optional user check for sameness
iterator findDuplicate(AstNode* nodep, V3DupFinderUserSame* checkp = nullptr);
iterator findDuplicate(AstNode* nodep, V3DupFinderUserSame* checkp = nullptr) VL_MT_DISABLED;
// Dump for debug
void dumpFile(const string& filename, bool tree);
void dumpFilePrefixed(const string& nameComment, bool tree = false);
void dumpFile(const string& filename, bool tree) VL_MT_DISABLED;
void dumpFilePrefixed(const string& nameComment, bool tree = false) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -20,17 +20,19 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
//============================================================================
class V3EmitC final {
public:
static void emitcConstPool();
static void emitcHeaders();
static void emitcConstPool() VL_MT_DISABLED;
static void emitcHeaders() VL_MT_DISABLED;
static void emitcImp();
static void emitcInlines();
static void emitcModel();
static void emitcSyms(bool dpiHdrOnly = false);
static void emitcFiles();
static void emitcInlines() VL_MT_DISABLED;
static void emitcModel() VL_MT_DISABLED;
static void emitcSyms(bool dpiHdrOnly = false) VL_MT_DISABLED;
static void emitcFiles() VL_MT_DISABLED;
};
#endif // Guard

View File

@ -22,7 +22,7 @@
#include "V3Ast.h"
#include "V3File.h"
#include "V3Global.h"
#include "V3ThreadSafety.h"
#include <cmath>
#include <cstdarg>

View File

@ -23,6 +23,7 @@
#include "V3EmitCConstInit.h"
#include "V3Global.h"
#include "V3MemberMap.h"
#include "V3ThreadSafety.h"
#include <algorithm>
#include <map>

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,11 +20,13 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
//============================================================================
class V3EmitCMain final {
public:
static void emit();
static void emit() VL_MT_DISABLED;
};
#endif // Guard

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,11 +20,13 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
//============================================================================
class V3EmitCMake final {
public:
static void emit();
static void emit() VL_MT_DISABLED;
};
#endif // Guard

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,6 +20,8 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class V3HierBlockPlan;
//============================================================================
@ -29,8 +31,8 @@ public:
// Number of source files after which to use parallel compiles
static const size_t PARALLEL_FILE_CNT_THRESHOLD = 128;
static void emitmk();
static void emitHierVerilation(const V3HierBlockPlan* planp);
static void emitmk() VL_MT_DISABLED;
static void emitHierVerilation(const V3HierBlockPlan* planp) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -20,6 +20,8 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNode;
class AstSenTree;

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,11 +20,13 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
//============================================================================
class V3EmitXml final {
public:
static void emitxml();
static void emitxml() VL_MT_DISABLED;
};
#endif // Guard

View File

@ -291,22 +291,27 @@ void V3Error::vlAbort() {
VL_GCOV_DUMP();
std::abort();
}
void V3Error::v3errorAcquireLock() VL_ACQUIRE(s().m_mutex) {
#ifndef V3ERROR_NO_GLOBAL_
V3Error::s().m_mutex.lockCheckStopRequest(
[]() -> void { V3ThreadPool::s().waitIfStopRequested(); });
void V3Error::v3errorAcquireLock(bool mtDisabledCodeUnit) VL_ACQUIRE(s().m_mutex) {
#if !defined(V3ERROR_NO_GLOBAL_)
if (!mtDisabledCodeUnit) {
V3Error::s().m_mutex.lockCheckStopRequest(
[]() -> void { V3ThreadPool::s().waitIfStopRequested(); });
} else {
V3Error::s().m_mutex.lock();
}
#else
V3Error::s().m_mutex.lock();
#endif
}
std::ostringstream& V3Error::v3errorPrep(V3ErrorCode code) VL_ACQUIRE(s().m_mutex) {
v3errorAcquireLock();
std::ostringstream& V3Error::v3errorPrep(V3ErrorCode code, bool mtDisabledCodeUnit)
VL_ACQUIRE(s().m_mutex) {
v3errorAcquireLock(mtDisabledCodeUnit);
s().v3errorPrep(code);
return v3errorStr();
}
std::ostringstream& V3Error::v3errorPrepFileLine(V3ErrorCode code, const char* file, int line)
VL_ACQUIRE(s().m_mutex) {
v3errorPrep(code) << file << ":" << std::dec << line << ": ";
std::ostringstream& V3Error::v3errorPrepFileLine(V3ErrorCode code, const char* file, int line,
bool mtDisabledCodeUnit) VL_ACQUIRE(s().m_mutex) {
v3errorPrep(code, mtDisabledCodeUnit) << file << ":" << std::dec << line << ": ";
return v3errorStr();
}
std::ostringstream& V3Error::v3errorStr() VL_REQUIRES(s().m_mutex) { return s().v3errorStr(); }

View File

@ -24,7 +24,7 @@
// Limited V3 headers here - this is a base class for Vlc etc
#include "V3String.h"
#ifndef V3ERROR_NO_GLOBAL_
#ifndef VL_MT_DISABLED_CODE_UNIT
#include "V3ThreadPool.h"
#endif
@ -518,9 +518,11 @@ public:
// Internals for v3error()/v3fatal() macros only
// Error end takes the string stream to output, be careful to seek() as needed
static void v3errorAcquireLock() VL_ACQUIRE(s().m_mutex);
static std::ostringstream& v3errorPrep(V3ErrorCode code) VL_ACQUIRE(s().m_mutex);
static std::ostringstream& v3errorPrepFileLine(V3ErrorCode code, const char* file, int line)
static void v3errorAcquireLock(bool checkStopRequest) VL_ACQUIRE(s().m_mutex);
static std::ostringstream& v3errorPrep(V3ErrorCode code, bool mtDisabledCodeUnit)
VL_ACQUIRE(s().m_mutex);
static std::ostringstream& v3errorPrepFileLine(V3ErrorCode code, const char* file, int line,
bool mtDisabledCodeUnit)
VL_ACQUIRE(s().m_mutex);
static std::ostringstream& v3errorStr() VL_REQUIRES(s().m_mutex);
// static, but often overridden in classes.
@ -530,8 +532,15 @@ public:
};
// Global versions, so that if the class doesn't define an operator, we get the functions anyway.
void v3errorEnd(std::ostringstream& sstr) VL_RELEASE(V3Error::s().m_mutex);
void v3errorEndFatal(std::ostringstream& sstr) VL_RELEASE(V3Error::s().m_mutex) VL_ATTR_NORETURN;
void v3errorEnd(std::ostringstream& sstr) VL_RELEASE(V3Error::s().m_mutex) VL_MT_SAFE;
void v3errorEndFatal(std::ostringstream& sstr)
VL_RELEASE(V3Error::s().m_mutex) VL_MT_SAFE VL_ATTR_NORETURN;
#ifdef VL_MT_DISABLED_CODE_UNIT
#define VL_MT_DISABLED_CODE_UNIT_DEFINED 1
#else
#define VL_MT_DISABLED_CODE_UNIT_DEFINED 0
#endif
// Theses allow errors using << operators: v3error("foo"<<"bar");
// Careful, you can't put () around msg, as you would in most macro definitions.
@ -541,9 +550,12 @@ void v3errorEndFatal(std::ostringstream& sstr) VL_RELEASE(V3Error::s().m_mutex)
// the comma operator (,) to guarantee the execution order here.
#define v3errorBuildMessage(prep, msg) \
(prep, static_cast<std::ostringstream&>(V3Error::v3errorStr() << msg))
#define v3warnCode(code, msg) v3errorEnd(v3errorBuildMessage(V3Error::v3errorPrep(code), msg))
#define v3warnCode(code, msg) \
v3errorEnd( \
v3errorBuildMessage(V3Error::v3errorPrep(code, VL_MT_DISABLED_CODE_UNIT_DEFINED), msg))
#define v3warnCodeFatal(code, msg) \
v3errorEndFatal(v3errorBuildMessage(V3Error::v3errorPrep(code), msg))
v3errorEndFatal( \
v3errorBuildMessage(V3Error::v3errorPrep(code, VL_MT_DISABLED_CODE_UNIT_DEFINED), msg))
#define v3warn(code, msg) v3warnCode(V3ErrorCode::code, msg)
#define v3info(msg) v3warnCode(V3ErrorCode::EC_INFO, msg)
#define v3error(msg) v3warnCode(V3ErrorCode::EC_ERROR, msg)
@ -553,10 +565,13 @@ void v3errorEndFatal(std::ostringstream& sstr) VL_RELEASE(V3Error::s().m_mutex)
// Use this instead of fatal() to mention the source code line.
#define v3fatalSrc(msg) \
v3errorEndFatal(v3errorBuildMessage( \
V3Error::v3errorPrepFileLine(V3ErrorCode::EC_FATALSRC, __FILE__, __LINE__), msg))
V3Error::v3errorPrepFileLine(V3ErrorCode::EC_FATALSRC, __FILE__, __LINE__, \
VL_MT_DISABLED_CODE_UNIT_DEFINED), \
msg))
// Use this when normal v3fatal is called in static method that overrides fileline.
#define v3fatalStatic(msg) \
::v3errorEndFatal(v3errorBuildMessage(V3Error::v3errorPrep(V3ErrorCode::EC_FATAL), msg))
::v3errorEndFatal(v3errorBuildMessage( \
V3Error::v3errorPrep(V3ErrorCode::EC_FATAL, VL_MT_DISABLED_CODE_UNIT_DEFINED), msg))
#define UINFO(level, stmsg) \
do { \

View File

@ -25,6 +25,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Expand final {
public:
static void expandAll(AstNetlist* nodep);
static void expandAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -37,6 +37,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -21,13 +21,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Force final {
public:
static void forceAll(AstNetlist* nodep);
static void forceAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -38,6 +38,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -21,6 +21,8 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
@ -29,10 +31,10 @@ class V3Fork final {
public:
// Move/copy variables to "anonymous" objects if their lifetime might exceed the scope of a
// procedure that declared them. Update the references apropriately.
static void makeDynamicScopes(AstNetlist* nodep);
static void makeDynamicScopes(AstNetlist* nodep) VL_MT_DISABLED;
// Create tasks out of blocks/statments that can outlive processes in which they were forked.
// Return value: number of tasks created
static void makeTasks(AstNetlist* nodep);
static void makeTasks(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -21,6 +21,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Gate final {
public:
static void gateAll(AstNetlist* nodep);
static void gateAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -28,7 +28,9 @@
#include "V3Error.h"
#include "V3FileLine.h"
#include "V3Mutex.h"
#include "V3Options.h"
#include "V3ThreadSafety.h"
#include <string>
#include <unordered_map>
@ -127,6 +129,7 @@ public:
V3Global() {}
void boot();
void shutdown(); // Release allocated resources
// ACCESSORS (general)
AstNetlist* rootp() const VL_MT_SAFE { return m_rootp; }
VWidthMinUsage widthMinUsage() const { return m_widthMinUsage; }
@ -134,8 +137,8 @@ public:
bool assertScoped() const { return m_assertScoped; }
// METHODS
void readFiles();
void removeStd();
void readFiles() VL_MT_DISABLED;
void removeStd() VL_MT_DISABLED;
void checkTree() const;
static void dumpCheckGlobalTree(const string& stagename, int newNumber = 0,
bool doDump = true);

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -23,6 +23,7 @@
#include "V3Error.h"
#include "V3List.h"
#include "V3Rtti.h"
#include "V3ThreadSafety.h"
#include <algorithm>
@ -88,19 +89,20 @@ protected:
friend class V3GraphEdge;
friend class GraphAcyc;
// METHODS
double orderDFSIterate(V3GraphVertex* vertexp);
void dumpEdge(std::ostream& os, const V3GraphVertex* vertexp, const V3GraphEdge* edgep);
double orderDFSIterate(V3GraphVertex* vertexp) VL_MT_DISABLED;
void dumpEdge(std::ostream& os, const V3GraphVertex* vertexp,
const V3GraphEdge* edgep) VL_MT_DISABLED;
void verticesUnlink() { m_vertices.reset(); }
// ACCESSORS
public:
V3Graph();
virtual ~V3Graph();
V3Graph() VL_MT_DISABLED;
virtual ~V3Graph() VL_MT_DISABLED;
virtual string dotRankDir() const { return "TB"; } // rankdir for dot plotting
// METHODS
void clear(); // Empty it of all vertices/edges, as if making a new object
void clearColors();
void clear() VL_MT_DISABLED; // Empty it of all vertices/edges, as if making a new object
void clearColors() VL_MT_DISABLED;
bool empty() const { return m_vertices.empty(); }
V3GraphVertex* verticesBeginp() const { return m_vertices.begin(); }
@ -109,66 +111,69 @@ public:
/// Assign same color to all vertices in the same weakly connected component
/// Thus different color if there's no edges between the two subgraphs
void weaklyConnected(V3EdgeFuncP edgeFuncp);
void weaklyConnected(V3EdgeFuncP edgeFuncp) VL_MT_DISABLED;
/// Assign same color to all vertices that are strongly connected
/// Thus different color if there's no directional circuit within the subgraphs.
/// (I.E. all loops will occur within each color, not between them.)
void stronglyConnected(V3EdgeFuncP edgeFuncp);
void stronglyConnected(V3EdgeFuncP edgeFuncp) VL_MT_DISABLED;
/// Assign an ordering number to all vertexes in a tree.
/// All nodes with no inputs will get rank 1
void rank(V3EdgeFuncP edgeFuncp);
void rank();
void rank(V3EdgeFuncP edgeFuncp) VL_MT_DISABLED;
void rank() VL_MT_DISABLED;
/// Sort all vertices and edges using the V3GraphVertex::sortCmp() function
void sortVertices();
void sortVertices() VL_MT_DISABLED;
/// Sort all edges and edges using the V3GraphEdge::sortCmp() function
void sortEdges();
void sortEdges() VL_MT_DISABLED;
/// Order all vertices by rank and fanout, lowest first
/// Sort all vertices by rank and fanout, lowest first
/// Sort all edges by weight, lowest first
/// Side-effect: assigns ranks to every node.
void order();
void order() VL_MT_DISABLED;
// Similar to order() but does not assign ranks. Caller must
// ensure that the graph has been ranked ahead of the call.
void orderPreRanked();
void orderPreRanked() VL_MT_DISABLED;
/// Make acyclical (into a tree) by breaking a minimal subset of cutable edges.
void acyclic(V3EdgeFuncP edgeFuncp);
void acyclic(V3EdgeFuncP edgeFuncp) VL_MT_DISABLED;
/// Remove any redundant edges, weights become MAX of any other weight
void removeRedundantEdges(V3EdgeFuncP edgeFuncp);
void removeRedundantEdges(V3EdgeFuncP edgeFuncp) VL_MT_DISABLED;
/// Remove any redundant edges, weights become SUM of any other weight
void removeRedundantEdgesSum(V3EdgeFuncP edgeFuncp);
void removeRedundantEdgesSum(V3EdgeFuncP edgeFuncp) VL_MT_DISABLED;
/// Remove any transitive edges. E.g. if have edges A->B, B->C, and A->C
/// then A->C is a "transitive" edge; it's implied by the first two
/// (assuming the DAG is a dependency graph.)
/// This algorithm can be expensive.
void removeTransitiveEdges();
void removeTransitiveEdges() VL_MT_DISABLED;
/// Call loopsVertexCb on any one loop starting where specified
void reportLoops(V3EdgeFuncP edgeFuncp, V3GraphVertex* vertexp);
void reportLoops(V3EdgeFuncP edgeFuncp, V3GraphVertex* vertexp) VL_MT_DISABLED;
/// Build a subgraph of all loops starting where specified
void subtreeLoops(V3EdgeFuncP edgeFuncp, V3GraphVertex* vertexp, V3Graph* loopGraphp);
void subtreeLoops(V3EdgeFuncP edgeFuncp, V3GraphVertex* vertexp,
V3Graph* loopGraphp) VL_MT_DISABLED;
/// Debugging
void dump(std::ostream& os = std::cout);
void dumpDotFile(const string& filename, bool colorAsSubgraph) const;
void dumpDotFilePrefixed(const string& nameComment, bool colorAsSubgraph = false) const;
void dumpDotFilePrefixedAlways(const string& nameComment, bool colorAsSubgraph = false) const;
void userClearVertices();
void userClearEdges();
static void selfTest();
void dump(std::ostream& os = std::cout) VL_MT_DISABLED;
void dumpDotFile(const string& filename, bool colorAsSubgraph) const VL_MT_DISABLED;
void dumpDotFilePrefixed(const string& nameComment,
bool colorAsSubgraph = false) const VL_MT_DISABLED;
void dumpDotFilePrefixedAlways(const string& nameComment,
bool colorAsSubgraph = false) const VL_MT_DISABLED;
void userClearVertices() VL_MT_DISABLED;
void userClearEdges() VL_MT_DISABLED;
static void selfTest() VL_MT_DISABLED;
// CALLBACKS
virtual void loopsMessageCb(V3GraphVertex* vertexp);
virtual void loopsVertexCb(V3GraphVertex* vertexp);
virtual void loopsMessageCb(V3GraphVertex* vertexp) VL_MT_DISABLED;
virtual void loopsVertexCb(V3GraphVertex* vertexp) VL_MT_DISABLED;
};
//============================================================================
@ -192,24 +197,24 @@ protected:
uint32_t m_user; // Marker for some algorithms
};
// METHODS
void verticesPushBack(V3Graph* graphp);
void verticesPushBack(V3Graph* graphp) VL_MT_DISABLED;
// ACCESSORS
void fanout(double fanout) { m_fanout = fanout; }
void inUnlink() { m_ins.reset(); } // Low level; normally unlinkDelete is what you want
void outUnlink() { m_outs.reset(); } // Low level; normally unlinkDelete is what you want
protected:
// CONSTRUCTORS
V3GraphVertex(V3Graph* graphp, const V3GraphVertex& old);
V3GraphVertex(V3Graph* graphp, const V3GraphVertex& old) VL_MT_DISABLED;
public:
explicit V3GraphVertex(V3Graph* graphp);
explicit V3GraphVertex(V3Graph* graphp) VL_MT_DISABLED;
//! Clone copy constructor. Doesn't copy edges or user/userp.
virtual V3GraphVertex* clone(V3Graph* graphp) const {
virtual V3GraphVertex* clone(V3Graph* graphp) const VL_MT_DISABLED {
return new V3GraphVertex{graphp, *this};
}
virtual ~V3GraphVertex() = default;
void unlinkEdges(V3Graph* graphp);
void unlinkDelete(V3Graph* graphp);
void unlinkEdges(V3Graph* graphp) VL_MT_DISABLED;
void unlinkDelete(V3Graph* graphp) VL_MT_DISABLED;
// METHODS
// Return true iff of type T
@ -275,23 +280,24 @@ public:
V3GraphVertex* verticesNextp() const { return m_vertices.nextp(); }
V3GraphEdge* inBeginp() const { return m_ins.begin(); }
bool inEmpty() const { return inBeginp() == nullptr; }
bool inSize1() const;
bool inSize1() const VL_MT_DISABLED;
V3GraphEdge* outBeginp() const { return m_outs.begin(); }
bool outEmpty() const { return outBeginp() == nullptr; }
bool outSize1() const;
bool outSize1() const VL_MT_DISABLED;
V3GraphEdge* beginp(GraphWay way) const { return way.forward() ? outBeginp() : inBeginp(); }
// METHODS
/// Error reporting
void v3errorEnd(std::ostringstream& str) const VL_RELEASE(V3Error::s().m_mutex);
void v3errorEndFatal(std::ostringstream& str) const VL_RELEASE(V3Error::s().m_mutex);
void v3errorEnd(std::ostringstream& str) const VL_RELEASE(V3Error::s().m_mutex) VL_MT_DISABLED;
void v3errorEndFatal(std::ostringstream& str) const
VL_RELEASE(V3Error::s().m_mutex) VL_MT_DISABLED;
/// Edges are routed around this vertex to point from "from" directly to "to"
void rerouteEdges(V3Graph* graphp);
void rerouteEdges(V3Graph* graphp) VL_MT_DISABLED;
/// Find the edge connecting ap and bp, where bp is wayward from ap.
/// If edge is not found returns nullptr. O(edges) performance.
V3GraphEdge* findConnectingEdgep(GraphWay way, const V3GraphVertex* waywardp);
V3GraphEdge* findConnectingEdgep(GraphWay way, const V3GraphVertex* waywardp) VL_MT_DISABLED;
};
std::ostream& operator<<(std::ostream& os, V3GraphVertex* vertexp);
std::ostream& operator<<(std::ostream& os, V3GraphVertex* vertexp) VL_MT_DISABLED;
//============================================================================
@ -320,25 +326,26 @@ protected:
};
// METHODS
void init(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top, int weight,
bool cutable = false);
bool cutable = false) VL_MT_DISABLED;
void cut() { m_weight = 0; } // 0 weight is same as disconnected
void outPushBack();
void inPushBack();
void outPushBack() VL_MT_DISABLED;
void inPushBack() VL_MT_DISABLED;
// CONSTRUCTORS
protected:
V3GraphEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top,
const V3GraphEdge& old) {
const V3GraphEdge& old) VL_MT_DISABLED {
init(graphp, fromp, top, old.m_weight, old.m_cutable);
}
public:
//! Add DAG from one node to the specified node
V3GraphEdge(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top, int weight,
bool cutable = false) {
bool cutable = false) VL_MT_DISABLED {
init(graphp, fromp, top, weight, cutable);
}
//! Clone copy constructor. Doesn't copy existing vertices or user/userp.
virtual V3GraphEdge* clone(V3Graph* graphp, V3GraphVertex* fromp, V3GraphVertex* top) const {
virtual V3GraphEdge* clone(V3Graph* graphp, V3GraphVertex* fromp,
V3GraphVertex* top) const VL_MT_DISABLED {
return new V3GraphEdge{graphp, fromp, top, *this};
}
virtual ~V3GraphEdge() = default;
@ -384,9 +391,9 @@ public:
if (!m_weight || !rhsp->m_weight) return 0;
return top()->sortCmp(rhsp->top());
}
void unlinkDelete();
V3GraphEdge* relinkFromp(V3GraphVertex* newFromp);
V3GraphEdge* relinkTop(V3GraphVertex* newTop);
void unlinkDelete() VL_MT_DISABLED;
V3GraphEdge* relinkFromp(V3GraphVertex* newFromp) VL_MT_DISABLED;
V3GraphEdge* relinkTop(V3GraphVertex* newTop) VL_MT_DISABLED;
// ACCESSORS
int weight() const { return m_weight; }
void weight(int weight) { m_weight = weight; }

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,6 +20,7 @@
#include "V3Error.h"
#include "V3Graph.h"
#include "V3GraphAlg.h"
#include "V3ThreadSafety.h"
//######################################################################
@ -39,21 +40,22 @@ class GraphPathChecker final : GraphAlg<const V3Graph> {
public:
// CONSTRUCTORS
explicit GraphPathChecker(const V3Graph* graphp,
V3EdgeFuncP edgeFuncp = V3GraphEdge::followAlwaysTrue);
~GraphPathChecker();
V3EdgeFuncP edgeFuncp
= V3GraphEdge::followAlwaysTrue) VL_MT_DISABLED;
~GraphPathChecker() VL_MT_DISABLED;
// METHODS
bool pathExistsFrom(const V3GraphVertex* fromp, const V3GraphVertex* top);
bool pathExistsFrom(const V3GraphVertex* fromp, const V3GraphVertex* top) VL_MT_DISABLED;
// If have edges A->B, B->C, and A->C then A->C is considered a
// "transitive" edge (implied by A->B and B->C) and it could be safely
// removed. Detect such an edge.
bool isTransitiveEdge(const V3GraphEdge* edgep);
bool isTransitiveEdge(const V3GraphEdge* edgep) VL_MT_DISABLED;
private:
bool pathExistsInternal(const V3GraphVertex* ap, const V3GraphVertex* bp,
unsigned* costp = nullptr);
void initHalfCriticalPaths(GraphWay way, bool checkOnly);
unsigned* costp = nullptr) VL_MT_DISABLED;
void initHalfCriticalPaths(GraphWay way, bool checkOnly) VL_MT_DISABLED;
void incGeneration() { ++m_generation; }
VL_UNCOPYABLE(GraphPathChecker);

View File

@ -14,6 +14,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -72,6 +72,8 @@
// Used for b) and c).
// This options is repeated for all instantiating hierarchical blocks.
#define VL_MT_DISABLED_CODE_UNIT 1
#include "V3HierBlock.h"
#include "V3Ast.h"

View File

@ -19,7 +19,8 @@
#include "verilatedos.h"
#include "V3Global.h"
#include "V3Options.h"
#include "V3ThreadSafety.h"
#include <map>
#include <set>
@ -56,13 +57,13 @@ private:
// METHODS
VL_UNCOPYABLE(V3HierBlock);
static StrGParams stringifyParams(const GParams& gparams, bool forGOption);
static StrGParams stringifyParams(const GParams& gparams, bool forGOption) VL_MT_DISABLED;
public:
V3HierBlock(const AstNodeModule* modp, const GParams& gparams)
: m_modp{modp}
, m_gparams{gparams} {}
~V3HierBlock();
~V3HierBlock() VL_MT_DISABLED;
void addParent(V3HierBlock* parentp) { m_parents.insert(parentp); }
void addChild(V3HierBlock* childp) { m_children.insert(childp); }
@ -73,19 +74,19 @@ public:
const AstNodeModule* modp() const { return m_modp; }
// For emitting Makefile and CMakeLists.txt
V3StringList commandArgs(bool forCMake) const;
V3StringList hierBlockArgs() const;
string hierPrefix() const;
string hierSomeFile(bool withDir, const char* prefix, const char* suffix) const;
string hierWrapper(bool withDir) const;
string hierMk(bool withDir) const;
string hierLib(bool withDir) const;
string hierGenerated(bool withDir) const;
V3StringList commandArgs(bool forCMake) const VL_MT_DISABLED;
V3StringList hierBlockArgs() const VL_MT_DISABLED;
string hierPrefix() const VL_MT_DISABLED;
string hierSomeFile(bool withDir, const char* prefix, const char* suffix) const VL_MT_DISABLED;
string hierWrapper(bool withDir) const VL_MT_DISABLED;
string hierMk(bool withDir) const VL_MT_DISABLED;
string hierLib(bool withDir) const VL_MT_DISABLED;
string hierGenerated(bool withDir) const VL_MT_DISABLED;
// Returns the original HDL file if it is not included in v3Global.opt.vFiles().
string vFileIfNecessary() const;
string vFileIfNecessary() const VL_MT_DISABLED;
// Write command line arguments to .f file for this hierarchical block
void writeCommandArgsFile(bool forCMake) const;
string commandArgsFileName(bool forCMake) const;
void writeCommandArgsFile(bool forCMake) const VL_MT_DISABLED;
string commandArgsFileName(bool forCMake) const VL_MT_DISABLED;
};
//######################################################################
@ -103,8 +104,8 @@ public:
using const_iterator = HierMap::const_iterator;
using HierVector = std::vector<const V3HierBlock*>;
void add(const AstNodeModule* modp, const std::vector<AstVar*>& gparams);
void registerUsage(const AstNodeModule* parentp, const AstNodeModule* childp);
void add(const AstNodeModule* modp, const std::vector<AstVar*>& gparams) VL_MT_DISABLED;
void registerUsage(const AstNodeModule* parentp, const AstNodeModule* childp) VL_MT_DISABLED;
const_iterator begin() const { return m_blocks.begin(); }
const_iterator end() const { return m_blocks.end(); }
@ -112,13 +113,13 @@ public:
// Returns all hierarchical blocks that sorted in leaf-first order.
// Latter block refers only already appeared hierarchical blocks.
HierVector hierBlocksSorted() const;
HierVector hierBlocksSorted() const VL_MT_DISABLED;
// Write command line arguments to .f files for child Verilation run
void writeCommandArgsFiles(bool forCMake) const;
static string topCommandArgsFileName(bool forCMake);
void writeCommandArgsFiles(bool forCMake) const VL_MT_DISABLED;
static string topCommandArgsFileName(bool forCMake) VL_MT_DISABLED;
static void createPlan(AstNetlist* nodep);
static void createPlan(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // guard

View File

@ -24,6 +24,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

View File

@ -20,13 +20,15 @@
#include "config_build.h"
#include "verilatedos.h"
#include "V3ThreadSafety.h"
class AstNetlist;
//============================================================================
class V3Inline final {
public:
static void inlineAll(AstNetlist* nodep);
static void inlineAll(AstNetlist* nodep) VL_MT_DISABLED;
};
#endif // Guard

View File

@ -21,6 +21,8 @@
//
//*************************************************************************
#define VL_MT_DISABLED_CODE_UNIT 1
#include "config_build.h"
#include "verilatedos.h"

Some files were not shown because too many files have changed in this diff Show More