diff --git a/src/V3Partition.cpp b/src/V3Partition.cpp index 4b37f53df..3263b8493 100644 --- a/src/V3Partition.cpp +++ b/src/V3Partition.cpp @@ -375,17 +375,17 @@ public: ~CpCostAccessor() = default; // Return cost of this node uint32_t cost(const V3GraphVertex* vxp) const { - const LogicMTask* const mtaskp = dynamic_cast(vxp); + const LogicMTask* const mtaskp = static_cast(vxp); return mtaskp->stepCost(); } // Return stored CP to this node uint32_t critPathCost(const V3GraphVertex* vxp, GraphWay way) const { - const LogicMTask* const mtaskp = dynamic_cast(vxp); + const LogicMTask* const mtaskp = static_cast(vxp); return mtaskp->critPathCost(way); } // Store a new CP to this node void setCritPathCost(V3GraphVertex* vxp, GraphWay way, uint32_t cost) const { - LogicMTask* const mtaskp = dynamic_cast(vxp); + LogicMTask* const mtaskp = static_cast(vxp); mtaskp->setCritPathCost(way, cost); } // Notify vxp that the wayward CP at the throughp-->vxp edge @@ -393,15 +393,15 @@ public: // This is our cue to update vxp's m_edges[!way][throughp]. void notifyEdgeCp(V3GraphVertex* vxp, GraphWay way, V3GraphVertex* throuvhVxp, uint32_t cp) const { - LogicMTask* const updateVxp = dynamic_cast(vxp); - LogicMTask* const lthrouvhVxp = dynamic_cast(throuvhVxp); + LogicMTask* const updateVxp = static_cast(vxp); + LogicMTask* const lthrouvhVxp = static_cast(throuvhVxp); EdgeSet& edges = updateVxp->m_edges[way.invert()]; const uint32_t edgeCp = edges.at(lthrouvhVxp); if (cp > edgeCp) edges.set(lthrouvhVxp, cp); } // Check that CP matches that of the longest edge wayward of vxp. void checkNewCpVersusEdges(V3GraphVertex* vxp, GraphWay way, uint32_t cp) const { - LogicMTask* const mtaskp = dynamic_cast(vxp); + LogicMTask* const mtaskp = static_cast(vxp); const EdgeSet& edges = mtaskp->m_edges[way.invert()]; // This is mtaskp's relative with longest !wayward inclusive CP: const auto edgeIt = edges.rbegin(); @@ -603,7 +603,7 @@ private: for (const V3GraphEdge* followp = fromp->outBeginp(); followp; followp = followp->outNextp()) { if (followp == excludedEdgep) continue; - LogicMTask* const nextp = dynamic_cast(followp->top()); + LogicMTask* const nextp = static_cast(followp->top()); if (pathExistsFromInternal(nextp, top, nullptr, generation)) return true; } return false; @@ -634,7 +634,7 @@ public: const LogicMTask* startp = nullptr; for (const V3GraphVertex* vxp = graphp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) { - const LogicMTask* const mtaskp = dynamic_cast(vxp); + const LogicMTask* const mtaskp = static_cast(vxp); if (!startp) { startp = mtaskp; continue; @@ -805,10 +805,10 @@ public: } // METHODS LogicMTask* furtherMTaskp(GraphWay way) const { - return dynamic_cast(this->furtherp(way)); + return static_cast(this->furtherp(way)); } - LogicMTask* fromMTaskp() const { return dynamic_cast(fromp()); } - LogicMTask* toMTaskp() const { return dynamic_cast(top()); } + LogicMTask* fromMTaskp() const { return static_cast(fromp()); } + LogicMTask* toMTaskp() const { return static_cast(top()); } bool mergeWouldCreateCycle() const { return LogicMTask::pathExistsFrom(fromMTaskp(), toMTaskp(), this); } @@ -962,7 +962,7 @@ static void partInitHalfCriticalPaths(GraphWay way, V3Graph* mtasksp, bool check GraphStreamUnordered order(mtasksp, way); const GraphWay rev = way.invert(); for (const V3GraphVertex* vertexp; (vertexp = order.nextp());) { - const LogicMTask* const mtaskcp = dynamic_cast(vertexp); + const LogicMTask* const mtaskcp = static_cast(vertexp); LogicMTask* const mtaskp = const_cast(mtaskcp); uint32_t cpCost = 0; #if VL_DEBUG @@ -977,7 +977,7 @@ static void partInitHalfCriticalPaths(GraphWay way, V3Graph* mtasksp, bool check "Should be no redundant edges in mtasks graph"); relatives.insert(edgep->furtherp(rev)); #endif - const LogicMTask* const relativep = dynamic_cast(edgep->furtherp(rev)); + const LogicMTask* const relativep = static_cast(edgep->furtherp(rev)); cpCost = std::max(cpCost, (relativep->critPathCost(way) + static_cast(relativep->stepCost()))); } @@ -1010,7 +1010,7 @@ static void partCheckCriticalPaths(V3Graph* mtasksp) { partInitHalfCriticalPaths(GraphWay::FORWARD, mtasksp, true); partInitHalfCriticalPaths(GraphWay::REVERSE, mtasksp, true); for (V3GraphVertex* vxp = mtasksp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) { - const LogicMTask* const mtaskp = dynamic_cast(vxp); + const LogicMTask* const mtaskp = static_cast(vxp); mtaskp->checkRelativesCp(GraphWay::FORWARD); mtaskp->checkRelativesCp(GraphWay::REVERSE); } @@ -1326,8 +1326,8 @@ private: MTaskEdge* mergeEdgep = mergeCanp->toMTaskEdge(); const SiblingMC* mergeSibsp = nullptr; if (mergeEdgep) { - top = dynamic_cast(mergeEdgep->top()); - fromp = dynamic_cast(mergeEdgep->fromp()); + top = static_cast(mergeEdgep->top()); + fromp = static_cast(mergeEdgep->fromp()); } else { mergeSibsp = mergeCanp->toSiblingMC(); UASSERT(mergeSibsp, "Failed to cast mergeCanp to either MTaskEdge or SiblingMC"); @@ -1437,14 +1437,14 @@ private: siblingPairFromRelatives(GraphWay::FORWARD, recipientp, true); unsigned edges = 0; for (V3GraphEdge* edgep = recipientp->outBeginp(); edgep; edgep = edgep->outNextp()) { - LogicMTask* const postreqp = dynamic_cast(edgep->top()); + LogicMTask* const postreqp = static_cast(edgep->top()); siblingPairFromRelatives(GraphWay::REVERSE, postreqp, false); ++edges; if (edges > PART_SIBLING_EDGE_LIMIT) break; } edges = 0; for (V3GraphEdge* edgep = recipientp->inBeginp(); edgep; edgep = edgep->inNextp()) { - LogicMTask* const prereqp = dynamic_cast(edgep->fromp()); + LogicMTask* const prereqp = static_cast(edgep->fromp()); siblingPairFromRelatives(GraphWay::FORWARD, prereqp, false); ++edges; if (edges > PART_SIBLING_EDGE_LIMIT) break; @@ -1491,8 +1491,8 @@ private: // Score this edge. Lower is better. The score is the new local CP // length if we merge these mtasks. ("Local" means the longest // critical path running through the merged node.) - const LogicMTask* const top = dynamic_cast(edgep->top()); - const LogicMTask* const fromp = dynamic_cast(edgep->fromp()); + const LogicMTask* const top = static_cast(edgep->top()); + const LogicMTask* const fromp = static_cast(edgep->fromp()); const uint32_t mergedCpCostFwd = std::max(fromp->critPathCost(GraphWay::FORWARD), top->critPathCostWithout(GraphWay::FORWARD, edgep)); @@ -1534,7 +1534,7 @@ private: std::vector shortestPrereqs; for (V3GraphEdge* edgep = mtaskp->beginp(way); edgep; edgep = edgep->nextp(way)) { - LogicMTask* const prereqp = dynamic_cast(edgep->furtherp(way)); + LogicMTask* const prereqp = static_cast(edgep->furtherp(way)); shortestPrereqs.push_back(prereqp); // Prevent nodes with huge numbers of edges from massively // slowing down the partitioner: @@ -1932,7 +1932,7 @@ public: OvvSet ovvSetSystemC(ovvOrder); for (V3GraphVertex* vxp = m_mtasksp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) { - LogicMTask* const mtaskp = dynamic_cast(vxp); + LogicMTask* const mtaskp = static_cast(vxp); // Should be only one MTaskMoveVertex in each mtask at this // stage, but whatever, write it as a loop: for (LogicMTask::VxList::const_iterator it = mtaskp->vertexListp()->begin(); @@ -2042,7 +2042,7 @@ public: TasksByRank tasksByRank; for (V3GraphVertex* vxp = m_mtasksp->verticesBeginp(); vxp; vxp = vxp->verticesNextp()) { - LogicMTask* const mtaskp = dynamic_cast(vxp); + LogicMTask* const mtaskp = static_cast(vxp); if (hasDpiHazard(mtaskp)) tasksByRank[vxp->rank()].insert(mtaskp); } mergeSameRankTasks(&tasksByRank); @@ -2521,7 +2521,7 @@ void V3Partition::hashGraphDebug(const V3Graph* graphp, const char* debugName) { void V3Partition::setupMTaskDeps(V3Graph* mtasksp, const Vx2MTaskMap* vx2mtaskp) { // Look at each mtask for (V3GraphVertex* itp = mtasksp->verticesBeginp(); itp; itp = itp->verticesNextp()) { - LogicMTask* const mtaskp = dynamic_cast(itp); + LogicMTask* const mtaskp = static_cast(itp); const LogicMTask::VxList* vertexListp = mtaskp->vertexListp(); // For each logic vertex in this mtask, create an mtask-to-mtask @@ -2651,7 +2651,7 @@ void V3Partition::go(V3Graph* mtasksp) { using SortedMTaskSet = std::set; SortedMTaskSet sorted; for (V3GraphVertex* itp = mtasksp->verticesBeginp(); itp; itp = itp->verticesNextp()) { - LogicMTask* const mtaskp = dynamic_cast(itp); + LogicMTask* const mtaskp = static_cast(itp); sorted.insert(mtaskp); } for (auto it = sorted.begin(); it != sorted.end(); ++it) { @@ -2667,7 +2667,7 @@ void V3Partition::go(V3Graph* mtasksp) { // Set color to indicate an mtaskId on every underlying MTaskMoveVertex. for (V3GraphVertex* itp = mtasksp->verticesBeginp(); itp; itp = itp->verticesNextp()) { - const LogicMTask* const mtaskp = dynamic_cast(itp); + const LogicMTask* const mtaskp = static_cast(itp); for (LogicMTask::VxList::const_iterator it = mtaskp->vertexListp()->begin(); it != mtaskp->vertexListp()->end(); ++it) { MTaskMoveVertex* const mvertexp = *it;