mirror of
https://github.com/verilator/verilator.git
synced 2026-09-03 16:28:53 +02:00
clang-format many files. No functional change.
Use nodist/clang_formatter to reformat files that are now clean.
This commit is contained in:
+17
-30
@@ -41,10 +41,11 @@ struct GraphPCNode {
|
||||
vluint64_t m_seenAtGeneration;
|
||||
|
||||
// CONSTRUCTORS
|
||||
GraphPCNode() : m_seenAtGeneration(0) {
|
||||
GraphPCNode()
|
||||
: m_seenAtGeneration(0) {
|
||||
for (int w = 0; w < GraphWay::NUM_WAYS; w++) m_cp[w] = 0;
|
||||
}
|
||||
~GraphPCNode() { }
|
||||
~GraphPCNode() {}
|
||||
};
|
||||
|
||||
//######################################################################
|
||||
@@ -53,8 +54,7 @@ struct GraphPCNode {
|
||||
GraphPathChecker::GraphPathChecker(const V3Graph* graphp, V3EdgeFuncP edgeFuncp)
|
||||
: GraphAlg<const V3Graph>(graphp, edgeFuncp)
|
||||
, m_generation(0) {
|
||||
for (V3GraphVertex* vxp = graphp->verticesBeginp();
|
||||
vxp; vxp = vxp->verticesNextp()) {
|
||||
for (V3GraphVertex* vxp = graphp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) {
|
||||
// Setup tracking structure for each node. If delete a vertex
|
||||
// there would be a leak, but ok as accept only const V3Graph*'s.
|
||||
vxp->userp(new GraphPCNode);
|
||||
@@ -66,8 +66,7 @@ GraphPathChecker::GraphPathChecker(const V3Graph* graphp, V3EdgeFuncP edgeFuncp)
|
||||
|
||||
GraphPathChecker::~GraphPathChecker() {
|
||||
// Free every GraphPCNode
|
||||
for (V3GraphVertex* vxp = m_graphp->verticesBeginp();
|
||||
vxp; vxp = vxp->verticesNextp()) {
|
||||
for (V3GraphVertex* vxp = m_graphp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) {
|
||||
GraphPCNode* nodep = static_cast<GraphPCNode*>(vxp->userp());
|
||||
VL_DO_DANGLING(delete nodep, nodep);
|
||||
vxp->userp(NULL);
|
||||
@@ -79,8 +78,7 @@ void GraphPathChecker::initHalfCriticalPaths(GraphWay way, bool checkOnly) {
|
||||
GraphWay rev = way.invert();
|
||||
while (const V3GraphVertex* vertexp = order.nextp()) {
|
||||
unsigned critPathCost = 0;
|
||||
for (V3GraphEdge* edgep = vertexp->beginp(rev);
|
||||
edgep; edgep = edgep->nextp(rev)) {
|
||||
for (V3GraphEdge* edgep = vertexp->beginp(rev); edgep; edgep = edgep->nextp(rev)) {
|
||||
if (!m_edgeFuncp(edgep)) continue;
|
||||
|
||||
V3GraphVertex* wrelativep = edgep->furtherp(rev);
|
||||
@@ -90,16 +88,15 @@ void GraphPathChecker::initHalfCriticalPaths(GraphWay way, bool checkOnly) {
|
||||
|
||||
GraphPCNode* ourUserp = static_cast<GraphPCNode*>(vertexp->userp());
|
||||
if (checkOnly) {
|
||||
UASSERT_OBJ(ourUserp->m_cp[way] == critPathCost,
|
||||
vertexp, "Validation of critical paths failed");
|
||||
UASSERT_OBJ(ourUserp->m_cp[way] == critPathCost, vertexp,
|
||||
"Validation of critical paths failed");
|
||||
} else {
|
||||
ourUserp->m_cp[way] = critPathCost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GraphPathChecker::pathExistsInternal(const V3GraphVertex* ap,
|
||||
const V3GraphVertex* bp,
|
||||
bool GraphPathChecker::pathExistsInternal(const V3GraphVertex* ap, const V3GraphVertex* bp,
|
||||
unsigned* costp) {
|
||||
GraphPCNode* auserp = static_cast<GraphPCNode*>(ap->userp());
|
||||
GraphPCNode* buserp = static_cast<GraphPCNode*>(bp->userp());
|
||||
@@ -118,31 +115,23 @@ bool GraphPathChecker::pathExistsInternal(const V3GraphVertex* ap,
|
||||
if (ap == bp) return true;
|
||||
|
||||
// Rule out an a->b path based on their CPs
|
||||
if (auserp->m_cp[GraphWay::REVERSE] < buserp->m_cp[GraphWay::REVERSE] + 1) {
|
||||
return false;
|
||||
}
|
||||
if (buserp->m_cp[GraphWay::FORWARD] < auserp->m_cp[GraphWay::FORWARD] + 1) {
|
||||
return false;
|
||||
}
|
||||
if (auserp->m_cp[GraphWay::REVERSE] < buserp->m_cp[GraphWay::REVERSE] + 1) return false;
|
||||
if (buserp->m_cp[GraphWay::FORWARD] < auserp->m_cp[GraphWay::FORWARD] + 1) return false;
|
||||
|
||||
// Slow path; visit some extended family
|
||||
bool foundPath = false;
|
||||
for (V3GraphEdge* edgep = ap->outBeginp();
|
||||
edgep && !foundPath; edgep = edgep->outNextp()) {
|
||||
for (V3GraphEdge* edgep = ap->outBeginp(); edgep && !foundPath; edgep = edgep->outNextp()) {
|
||||
if (!m_edgeFuncp(edgep)) continue;
|
||||
|
||||
unsigned childCost;
|
||||
if (pathExistsInternal(edgep->top(), bp, &childCost)) {
|
||||
foundPath = true;
|
||||
}
|
||||
if (pathExistsInternal(edgep->top(), bp, &childCost)) foundPath = true;
|
||||
if (costp) *costp += childCost;
|
||||
}
|
||||
|
||||
return foundPath;
|
||||
}
|
||||
|
||||
bool GraphPathChecker::pathExistsFrom(const V3GraphVertex* fromp,
|
||||
const V3GraphVertex* top) {
|
||||
bool GraphPathChecker::pathExistsFrom(const V3GraphVertex* fromp, const V3GraphVertex* top) {
|
||||
incGeneration();
|
||||
return pathExistsInternal(fromp, top);
|
||||
}
|
||||
@@ -151,12 +140,10 @@ bool GraphPathChecker::isTransitiveEdge(const V3GraphEdge* edgep) {
|
||||
const V3GraphVertex* fromp = edgep->fromp();
|
||||
const V3GraphVertex* top = edgep->top();
|
||||
incGeneration();
|
||||
for (const V3GraphEdge* fromOutp = fromp->outBeginp();
|
||||
fromOutp; fromOutp = fromOutp->outNextp()) {
|
||||
for (const V3GraphEdge* fromOutp = fromp->outBeginp(); fromOutp;
|
||||
fromOutp = fromOutp->outNextp()) {
|
||||
if (fromOutp == edgep) continue;
|
||||
if (pathExistsInternal(fromOutp->top(), top)) {
|
||||
return true;
|
||||
}
|
||||
if (pathExistsInternal(fromOutp->top(), top)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user