mirror of
https://github.com/verilator/verilator.git
synced 2025-01-15 11:04:14 +00:00
Remove scope pointer from OrderEitherVertex.
For ordering, only the scope of logic vertices should be relevant, so remove the scope pointer from OrderEitherVertex and move it into OrderLogicVertex. This does not change single-threaded scheduling at all. Theoretically, multi-threaded scheduling should not be affected either though due to some implementation quirk depending on vertex order in a graph the MT schedule is perturbed by this change, but the performance effect of this is negligible on all benchmarks I have access to. No functional change intended. Fixes #3442
This commit is contained in:
parent
160f3ee4a7
commit
3af5e7e8da
@ -138,24 +138,15 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// METHODS
|
// METHODS
|
||||||
OrderVarVertex* getVarVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varscp,
|
OrderVarVertex* getVarVertex(V3Graph* graphp, AstVarScope* varscp, VarVertexType type) {
|
||||||
VarVertexType type) {
|
|
||||||
const unsigned idx = static_cast<unsigned>(type);
|
const unsigned idx = static_cast<unsigned>(type);
|
||||||
OrderVarVertex* vertexp = m_vertexps[idx];
|
OrderVarVertex* vertexp = m_vertexps[idx];
|
||||||
if (!vertexp) {
|
if (!vertexp) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case VarVertexType::STD:
|
case VarVertexType::STD: vertexp = new OrderVarStdVertex{graphp, varscp}; break;
|
||||||
vertexp = new OrderVarStdVertex(graphp, scopep, varscp);
|
case VarVertexType::PRE: vertexp = new OrderVarPreVertex{graphp, varscp}; break;
|
||||||
break;
|
case VarVertexType::PORD: vertexp = new OrderVarPordVertex{graphp, varscp}; break;
|
||||||
case VarVertexType::PRE:
|
case VarVertexType::POST: vertexp = new OrderVarPostVertex{graphp, varscp}; break;
|
||||||
vertexp = new OrderVarPreVertex(graphp, scopep, varscp);
|
|
||||||
break;
|
|
||||||
case VarVertexType::PORD:
|
|
||||||
vertexp = new OrderVarPordVertex(graphp, scopep, varscp);
|
|
||||||
break;
|
|
||||||
case VarVertexType::POST:
|
|
||||||
vertexp = new OrderVarPostVertex(graphp, scopep, varscp);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
m_vertexps[idx] = vertexp;
|
m_vertexps[idx] = vertexp;
|
||||||
}
|
}
|
||||||
@ -228,7 +219,7 @@ class OrderBuildVisitor final : public VNVisitor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OrderVarVertex* getVarVertex(AstVarScope* varscp, VarVertexType type) {
|
OrderVarVertex* getVarVertex(AstVarScope* varscp, VarVertexType type) {
|
||||||
return m_orderUser(varscp).getVarVertex(m_graphp, m_scopep, varscp, type);
|
return m_orderUser(varscp).getVarVertex(m_graphp, varscp, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
// VISITORS
|
// VISITORS
|
||||||
@ -631,9 +622,9 @@ public:
|
|||||||
// Clients of ProcessMoveBuildGraph must supply MoveVertexMaker
|
// Clients of ProcessMoveBuildGraph must supply MoveVertexMaker
|
||||||
// which creates new T_MoveVertex's. Each new vertex wraps lvertexp
|
// which creates new T_MoveVertex's. Each new vertex wraps lvertexp
|
||||||
// (which may be nullptr.)
|
// (which may be nullptr.)
|
||||||
virtual T_MoveVertex* makeVertexp( //
|
virtual T_MoveVertex* makeVertexp(OrderLogicVertex* lvertexp,
|
||||||
OrderLogicVertex* lvertexp, const OrderEitherVertex* varVertexp,
|
const OrderEitherVertex* varVertexp,
|
||||||
const AstScope* scopep, const AstSenTree* domainp)
|
const AstSenTree* domainp)
|
||||||
= 0;
|
= 0;
|
||||||
virtual void freeVertexp(T_MoveVertex* freeMep) = 0;
|
virtual void freeVertexp(T_MoveVertex* freeMep) = 0;
|
||||||
};
|
};
|
||||||
@ -680,8 +671,8 @@ public:
|
|||||||
// For each logic node, make a T_MoveVertex
|
// For each logic node, make a T_MoveVertex
|
||||||
for (V3GraphVertex* itp = m_graphp->verticesBeginp(); itp; itp = itp->verticesNextp()) {
|
for (V3GraphVertex* itp = m_graphp->verticesBeginp(); itp; itp = itp->verticesNextp()) {
|
||||||
if (OrderLogicVertex* const lvertexp = dynamic_cast<OrderLogicVertex*>(itp)) {
|
if (OrderLogicVertex* const lvertexp = dynamic_cast<OrderLogicVertex*>(itp)) {
|
||||||
T_MoveVertex* const moveVxp = m_vxMakerp->makeVertexp(
|
T_MoveVertex* const moveVxp
|
||||||
lvertexp, nullptr, lvertexp->scopep(), lvertexp->domainp());
|
= m_vxMakerp->makeVertexp(lvertexp, nullptr, lvertexp->domainp());
|
||||||
if (moveVxp) {
|
if (moveVxp) {
|
||||||
// Cross link so we can find it later
|
// Cross link so we can find it later
|
||||||
m_logic2move[lvertexp] = moveVxp;
|
m_logic2move[lvertexp] = moveVxp;
|
||||||
@ -782,10 +773,10 @@ private:
|
|||||||
const V3GraphVertex* nonLogicVxp = edgep->top();
|
const V3GraphVertex* nonLogicVxp = edgep->top();
|
||||||
const VxDomPair key(nonLogicVxp, domainp);
|
const VxDomPair key(nonLogicVxp, domainp);
|
||||||
if (!m_var2move[key]) {
|
if (!m_var2move[key]) {
|
||||||
const OrderEitherVertex* const eithp
|
const OrderVarVertex* const eithp
|
||||||
= dynamic_cast<const OrderEitherVertex*>(nonLogicVxp);
|
= static_cast<const OrderVarVertex*>(nonLogicVxp);
|
||||||
T_MoveVertex* const newMoveVxp
|
T_MoveVertex* const newMoveVxp
|
||||||
= m_vxMakerp->makeVertexp(nullptr, eithp, eithp->scopep(), domainp);
|
= m_vxMakerp->makeVertexp(nullptr, eithp, domainp);
|
||||||
m_var2move[key] = newMoveVxp;
|
m_var2move[key] = newMoveVxp;
|
||||||
|
|
||||||
// Find downstream logics that depend on (var, domain)
|
// Find downstream logics that depend on (var, domain)
|
||||||
@ -824,9 +815,9 @@ public:
|
|||||||
, m_pomWaitingp{pomWaitingp} {}
|
, m_pomWaitingp{pomWaitingp} {}
|
||||||
// METHODS
|
// METHODS
|
||||||
virtual OrderMoveVertex* makeVertexp(OrderLogicVertex* lvertexp, const OrderEitherVertex*,
|
virtual OrderMoveVertex* makeVertexp(OrderLogicVertex* lvertexp, const OrderEitherVertex*,
|
||||||
const AstScope* scopep,
|
|
||||||
const AstSenTree* domainp) override {
|
const AstSenTree* domainp) override {
|
||||||
OrderMoveVertex* const resultp = new OrderMoveVertex(m_pomGraphp, lvertexp);
|
OrderMoveVertex* const resultp = new OrderMoveVertex(m_pomGraphp, lvertexp);
|
||||||
|
AstScope* const scopep = lvertexp ? lvertexp->scopep() : nullptr;
|
||||||
resultp->domScopep(OrderMoveDomScope::findCreate(domainp, scopep));
|
resultp->domScopep(OrderMoveDomScope::findCreate(domainp, scopep));
|
||||||
resultp->m_pomWaitingE.pushBack(*m_pomWaitingp, resultp);
|
resultp->m_pomWaitingE.pushBack(*m_pomWaitingp, resultp);
|
||||||
return resultp;
|
return resultp;
|
||||||
@ -849,9 +840,8 @@ public:
|
|||||||
: m_pomGraphp{pomGraphp} {}
|
: m_pomGraphp{pomGraphp} {}
|
||||||
virtual MTaskMoveVertex* makeVertexp(OrderLogicVertex* lvertexp,
|
virtual MTaskMoveVertex* makeVertexp(OrderLogicVertex* lvertexp,
|
||||||
const OrderEitherVertex* varVertexp,
|
const OrderEitherVertex* varVertexp,
|
||||||
const AstScope* scopep,
|
|
||||||
const AstSenTree* domainp) override {
|
const AstSenTree* domainp) override {
|
||||||
return new MTaskMoveVertex(m_pomGraphp, lvertexp, varVertexp, scopep, domainp);
|
return new MTaskMoveVertex(m_pomGraphp, lvertexp, varVertexp, domainp);
|
||||||
}
|
}
|
||||||
virtual void freeVertexp(MTaskMoveVertex* freeMep) override {
|
virtual void freeVertexp(MTaskMoveVertex* freeMep) override {
|
||||||
freeMep->unlinkDelete(m_pomGraphp);
|
freeMep->unlinkDelete(m_pomGraphp);
|
||||||
|
@ -72,17 +72,13 @@ public:
|
|||||||
// Vertex types
|
// Vertex types
|
||||||
|
|
||||||
class OrderEitherVertex VL_NOT_FINAL : public V3GraphVertex {
|
class OrderEitherVertex VL_NOT_FINAL : public V3GraphVertex {
|
||||||
AstScope* const m_scopep; // Scope the vertex is in
|
|
||||||
AstSenTree* m_domainp; // Clock domain (nullptr = to be computed as we iterate)
|
AstSenTree* m_domainp; // Clock domain (nullptr = to be computed as we iterate)
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
OrderEitherVertex(V3Graph* graphp, AstScope* scopep, AstSenTree* domainp)
|
OrderEitherVertex(V3Graph* graphp, AstSenTree* domainp)
|
||||||
: V3GraphVertex{graphp}
|
: V3GraphVertex{graphp}
|
||||||
, m_scopep{scopep}
|
, m_domainp{domainp} {}
|
||||||
, m_domainp{domainp} {
|
|
||||||
UASSERT(scopep, "Must not be null");
|
|
||||||
}
|
|
||||||
virtual ~OrderEitherVertex() override = default;
|
virtual ~OrderEitherVertex() override = default;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -92,24 +88,22 @@ public:
|
|||||||
// ACCESSORS
|
// ACCESSORS
|
||||||
AstSenTree* domainp() const { return m_domainp; }
|
AstSenTree* domainp() const { return m_domainp; }
|
||||||
void domainp(AstSenTree* domainp) { m_domainp = domainp; }
|
void domainp(AstSenTree* domainp) { m_domainp = domainp; }
|
||||||
AstScope* scopep() const { return m_scopep; }
|
|
||||||
|
|
||||||
// LCOV_EXCL_START // Debug code
|
|
||||||
virtual string dotName() const override { return cvtToHex(m_scopep) + "_"; }
|
|
||||||
// LCOV_EXCL_STOP
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class OrderLogicVertex final : public OrderEitherVertex {
|
class OrderLogicVertex final : public OrderEitherVertex {
|
||||||
AstNode* const m_nodep;
|
AstNode* const m_nodep; // The logic this vertex represents
|
||||||
|
AstScope* const m_scopep; // Scope the logic is under
|
||||||
AstSenTree* const m_hybridp;
|
AstSenTree* const m_hybridp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
OrderLogicVertex(V3Graph* graphp, AstScope* scopep, AstSenTree* domainp, AstSenTree* hybridp,
|
OrderLogicVertex(V3Graph* graphp, AstScope* scopep, AstSenTree* domainp, AstSenTree* hybridp,
|
||||||
AstNode* nodep)
|
AstNode* nodep)
|
||||||
: OrderEitherVertex{graphp, scopep, domainp}
|
: OrderEitherVertex{graphp, domainp}
|
||||||
, m_nodep{nodep}
|
, m_nodep{nodep}
|
||||||
|
, m_scopep{scopep}
|
||||||
, m_hybridp{hybridp} {
|
, m_hybridp{hybridp} {
|
||||||
|
UASSERT_OBJ(scopep, nodep, "Must not be null");
|
||||||
UASSERT_OBJ(!(domainp && hybridp), nodep, "Cannot have bot domainp and hybridp set");
|
UASSERT_OBJ(!(domainp && hybridp), nodep, "Cannot have bot domainp and hybridp set");
|
||||||
}
|
}
|
||||||
virtual ~OrderLogicVertex() override = default;
|
virtual ~OrderLogicVertex() override = default;
|
||||||
@ -119,6 +113,7 @@ public:
|
|||||||
|
|
||||||
// ACCESSORS
|
// ACCESSORS
|
||||||
AstNode* nodep() const { return m_nodep; }
|
AstNode* nodep() const { return m_nodep; }
|
||||||
|
AstScope* scopep() const { return m_scopep; }
|
||||||
AstSenTree* hybridp() const { return m_hybridp; }
|
AstSenTree* hybridp() const { return m_hybridp; }
|
||||||
|
|
||||||
// LCOV_EXCL_START // Debug code
|
// LCOV_EXCL_START // Debug code
|
||||||
@ -136,8 +131,8 @@ class OrderVarVertex VL_NOT_FINAL : public OrderEitherVertex {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
OrderVarVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* vscp)
|
OrderVarVertex(V3Graph* graphp, AstVarScope* vscp)
|
||||||
: OrderEitherVertex{graphp, scopep, nullptr}
|
: OrderEitherVertex{graphp, nullptr}
|
||||||
, m_vscp{vscp} {}
|
, m_vscp{vscp} {}
|
||||||
virtual ~OrderVarVertex() override = default;
|
virtual ~OrderVarVertex() override = default;
|
||||||
|
|
||||||
@ -156,8 +151,8 @@ public:
|
|||||||
class OrderVarStdVertex final : public OrderVarVertex {
|
class OrderVarStdVertex final : public OrderVarVertex {
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
OrderVarStdVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp)
|
OrderVarStdVertex(V3Graph* graphp, AstVarScope* varScp)
|
||||||
: OrderVarVertex{graphp, scopep, varScp} {}
|
: OrderVarVertex{graphp, varScp} {}
|
||||||
virtual ~OrderVarStdVertex() override = default;
|
virtual ~OrderVarStdVertex() override = default;
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
@ -172,8 +167,8 @@ public:
|
|||||||
class OrderVarPreVertex final : public OrderVarVertex {
|
class OrderVarPreVertex final : public OrderVarVertex {
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
OrderVarPreVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp)
|
OrderVarPreVertex(V3Graph* graphp, AstVarScope* varScp)
|
||||||
: OrderVarVertex{graphp, scopep, varScp} {}
|
: OrderVarVertex{graphp, varScp} {}
|
||||||
virtual ~OrderVarPreVertex() override = default;
|
virtual ~OrderVarPreVertex() override = default;
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
@ -188,8 +183,8 @@ public:
|
|||||||
class OrderVarPostVertex final : public OrderVarVertex {
|
class OrderVarPostVertex final : public OrderVarVertex {
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
OrderVarPostVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp)
|
OrderVarPostVertex(V3Graph* graphp, AstVarScope* varScp)
|
||||||
: OrderVarVertex{graphp, scopep, varScp} {}
|
: OrderVarVertex{graphp, varScp} {}
|
||||||
virtual ~OrderVarPostVertex() override = default;
|
virtual ~OrderVarPostVertex() override = default;
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
@ -204,8 +199,8 @@ public:
|
|||||||
class OrderVarPordVertex final : public OrderVarVertex {
|
class OrderVarPordVertex final : public OrderVarVertex {
|
||||||
public:
|
public:
|
||||||
// CONSTRUCTOR
|
// CONSTRUCTOR
|
||||||
OrderVarPordVertex(V3Graph* graphp, AstScope* scopep, AstVarScope* varScp)
|
OrderVarPordVertex(V3Graph* graphp, AstVarScope* varScp)
|
||||||
: OrderVarVertex{graphp, scopep, varScp} {}
|
: OrderVarVertex{graphp, varScp} {}
|
||||||
virtual ~OrderVarPordVertex() override = default;
|
virtual ~OrderVarPordVertex() override = default;
|
||||||
|
|
||||||
// METHODS
|
// METHODS
|
||||||
@ -325,16 +320,14 @@ class MTaskMoveVertex final : public V3GraphVertex {
|
|||||||
// or a var node, it can't be both.
|
// or a var node, it can't be both.
|
||||||
OrderLogicVertex* const m_logicp; // Logic represented by this vertex
|
OrderLogicVertex* const m_logicp; // Logic represented by this vertex
|
||||||
const OrderEitherVertex* const m_varp; // Var represented by this vertex
|
const OrderEitherVertex* const m_varp; // Var represented by this vertex
|
||||||
const AstScope* const m_scopep;
|
|
||||||
const AstSenTree* const m_domainp;
|
const AstSenTree* const m_domainp;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MTaskMoveVertex(V3Graph* graphp, OrderLogicVertex* logicp, const OrderEitherVertex* varp,
|
MTaskMoveVertex(V3Graph* graphp, OrderLogicVertex* logicp, const OrderEitherVertex* varp,
|
||||||
const AstScope* scopep, const AstSenTree* domainp)
|
const AstSenTree* domainp)
|
||||||
: V3GraphVertex{graphp}
|
: V3GraphVertex{graphp}
|
||||||
, m_logicp{logicp}
|
, m_logicp{logicp}
|
||||||
, m_varp{varp}
|
, m_varp{varp}
|
||||||
, m_scopep{scopep}
|
|
||||||
, m_domainp{domainp} {
|
, m_domainp{domainp} {
|
||||||
UASSERT(!(logicp && varp), "MTaskMoveVertex: logicp and varp may not both be set!\n");
|
UASSERT(!(logicp && varp), "MTaskMoveVertex: logicp and varp may not both be set!\n");
|
||||||
}
|
}
|
||||||
@ -343,7 +336,7 @@ public:
|
|||||||
// ACCESSORS
|
// ACCESSORS
|
||||||
OrderLogicVertex* logicp() const { return m_logicp; }
|
OrderLogicVertex* logicp() const { return m_logicp; }
|
||||||
const OrderEitherVertex* varp() const { return m_varp; }
|
const OrderEitherVertex* varp() const { return m_varp; }
|
||||||
const AstScope* scopep() const { return m_scopep; }
|
const AstScope* scopep() const { return m_logicp ? m_logicp->scopep() : nullptr; }
|
||||||
const AstSenTree* domainp() const { return m_domainp; }
|
const AstSenTree* domainp() const { return m_domainp; }
|
||||||
|
|
||||||
virtual string dotColor() const override {
|
virtual string dotColor() const override {
|
||||||
|
Loading…
Reference in New Issue
Block a user