diff --git a/graph/Graph.cc b/graph/Graph.cc index d30c464c..b3f428d1 100644 --- a/graph/Graph.cc +++ b/graph/Graph.cc @@ -660,12 +660,48 @@ Graph::prevPaths(Vertex *vertex) const return prev_paths_.pointer(vertex->prevPaths()); } +void +Graph::deletePrevPaths(Vertex *vertex, + uint32_t count) +{ + if (vertex->prevPaths() != object_id_null) { + { + LockGuard lock(prev_paths_lock_); + prev_paths_.destroy(vertex->prevPaths(), count); + } + vertex->setPrevPaths(object_id_null); + } +} + void Graph::clearPrevPaths() { prev_paths_.clear(); } +// No locks. +void +Graph::deletePaths(Vertex *vertex, + uint32_t count) +{ + if (vertex->arrivals() != arrival_null) { + arrivals_.destroy(vertex->arrivals(), count); + vertex->setArrivals(arrival_null); + } + if (vertex->requireds() != arrival_null) { + requireds_.destroy(vertex->requireds(), count); + vertex->setRequireds(arrival_null); + } + + if (vertex->prevPaths() != object_id_null) { + prev_paths_.destroy(vertex->prevPaths(), count); + vertex->setPrevPaths(object_id_null); + } + + vertex->tag_group_index_ = tag_group_index_max; + vertex->crpr_path_pruning_disabled_ = false; +} + //////////////////////////////////////////////////////////////// const Slew & @@ -1245,16 +1281,6 @@ Vertex::setPrevPaths(PrevPathId prev_paths) prev_paths_ = prev_paths; } -void -Vertex::deletePaths() -{ - arrivals_ = arrival_null; - requireds_ = arrival_null; - prev_paths_ = prev_path_null; - tag_group_index_ = tag_group_index_max; - crpr_path_pruning_disabled_ = false; -} - LogicValue Vertex::simValue() const { diff --git a/include/sta/Graph.hh b/include/sta/Graph.hh index efa0637d..01b2b773 100644 --- a/include/sta/Graph.hh +++ b/include/sta/Graph.hh @@ -113,7 +113,13 @@ public: PathVertexRep *makePrevPaths(Vertex *vertex, uint32_t count); PathVertexRep *prevPaths(Vertex *vertex) const; + void deletePrevPaths(Vertex *vertex, + uint32_t count); void clearPrevPaths(); + // Private to Search::deletePaths1(Vertex). + void deletePaths(Vertex *vertex, + uint32_t count); + // Reported slew are the same as those in the liberty tables. // reported_slews = measured_slews / slew_derate_from_library // Measured slews are between slew_lower_threshold and slew_upper_threshold. @@ -333,8 +339,6 @@ public: // ObjectTable interface. ObjectIdx objectIdx() const { return object_idx_; } void setObjectIdx(ObjectIdx idx); - // private to Search.cc - void deletePaths(); static int transitionCount() { return 2; } // rise/fall diff --git a/include/sta/Search.hh b/include/sta/Search.hh index 69a032de..5828f7ba 100644 --- a/include/sta/Search.hh +++ b/include/sta/Search.hh @@ -498,6 +498,8 @@ protected: const PathAnalysisPt *path_ap); void deletePaths(); void deletePaths(Vertex *vertex); + // Delete with incremental tns/wns update. + void deletePathsIncr(Vertex *vertex); TagGroup *findTagGroup(TagGroupBldr *group_bldr); void deleteFilterTags(); void deleteFilterTagGroups(); diff --git a/search/Search.cc b/search/Search.cc index 0aa9ac0c..ecfa8fe2 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -403,7 +403,7 @@ Search::deletePaths() VertexIterator vertex_iter(graph_); while (vertex_iter.hasNext()) { Vertex *vertex = vertex_iter.next(); - vertex->deletePaths(); + deletePaths(vertex); } filtered_arrivals_->clear(); graph_->clearArrivals(); @@ -412,13 +412,24 @@ Search::deletePaths() } } +// Delete with incremental tns/wns update. void -Search::deletePaths(Vertex *vertex) +Search::deletePathsIncr(Vertex *vertex) { tnsNotifyBefore(vertex); if (worst_slacks_) worst_slacks_->worstSlackNotifyBefore(vertex); - vertex->deletePaths(); + deletePaths(vertex); +} + +void +Search::deletePaths(Vertex *vertex) +{ + TagGroup *tag_group = tagGroup(vertex); + if (tag_group) { + int arrival_count = tag_group->arrivalCount(); + graph_->deletePaths(vertex, arrival_count); + } } //////////////////////////////////////////////////////////////// @@ -510,7 +521,7 @@ Search::deleteFilteredArrivals() for (Vertex *vertex : *filtered_arrivals_) { if (isClock(vertex)) clk_arrivals_valid_ = false; - deletePaths(vertex); + deletePathsIncr(vertex); arrivalInvalid(vertex); requiredInvalid(vertex); } @@ -677,7 +688,7 @@ void Search::deleteVertexBefore(Vertex *vertex) { if (arrivals_exist_) { - deletePaths(vertex); + deletePathsIncr(vertex); arrival_iter_->deleteVertexBefore(vertex); invalid_arrivals_->erase(vertex); filtered_arrivals_->erase(vertex); @@ -759,7 +770,7 @@ void Search::arrivalInvalidDelete(Vertex *vertex) { arrivalInvalid(vertex); - vertex->deletePaths(); + deletePaths(vertex); } void @@ -1457,7 +1468,7 @@ Search::seedArrival(Vertex *vertex) setVertexArrivals(vertex, &tag_bldr); } else { - deletePaths(vertex); + deletePathsIncr(vertex); if (search_adj_->searchFrom(vertex)) arrival_iter_->enqueueAdjacentVertices(vertex, search_adj_); } @@ -2663,7 +2674,7 @@ Search::setVertexArrivals(Vertex *vertex, TagGroupBldr *tag_bldr) { if (tag_bldr->empty()) - deletePaths(vertex); + deletePathsIncr(vertex); else { TagGroup *prev_tag_group = tagGroup(vertex); Arrival *prev_arrivals = graph_->arrivals(vertex); @@ -2682,7 +2693,7 @@ Search::setVertexArrivals(Vertex *vertex, else { // Prev paths not required. prev_paths = nullptr; - vertex->setPrevPaths(prev_path_null); + graph_->deletePrevPaths(vertex, arrival_count); } tag_bldr->copyArrivals(tag_group, prev_arrivals, prev_paths); vertex->setTagGroupIndex(tag_group->index());