From b9824b62b245c497b08ba08dde7789d63e8df2b0 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Fri, 25 Sep 2020 17:35:56 -0700 Subject: [PATCH] CheckCrpr::clkPathPrev --- search/Crpr.cc | 27 ++++++++++++--------------- search/Crpr.hh | 10 +++++----- search/Search.cc | 5 ++--- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/search/Crpr.cc b/search/Crpr.cc index 64496ffb..9de09f84 100644 --- a/search/Crpr.cc +++ b/search/Crpr.cc @@ -55,27 +55,24 @@ CheckCrpr::clkPathPrev(const PathVertex *path, int arrival_index; bool exists; path->arrivalIndex(arrival_index, exists); - return clkPathPrev(vertex, arrival_index, tmp); + tmp = clkPathPrev(vertex, arrival_index); + if (tmp.isNull()) + return nullptr; + else + return &tmp; } -PathVertex * +PathVertex CheckCrpr::clkPathPrev(Vertex *vertex, - int arrival_index, - PathVertex &tmp) + int arrival_index) { PathVertexRep *prevs = graph_->prevPaths(vertex); - if (prevs) { - PathVertexRep *prev = &prevs[arrival_index]; - if (prev->isNull()) - return nullptr; - else { - tmp.init(graph_->vertex(prev->vertexId()), - search_->tag(prev->tagIndex()), this); - return &tmp; - } - } - else + if (prevs) + return PathVertex(prevs[arrival_index], this); + else { internalError("missing prev paths"); + return PathVertex(); + } } //////////////////////////////////////////////////////////////// diff --git a/search/Crpr.hh b/search/Crpr.hh index 0e976931..80186639 100644 --- a/search/Crpr.hh +++ b/search/Crpr.hh @@ -51,14 +51,14 @@ public: Pin *&crpr_pin); // Previous clk path when crpr is enabled. - PathVertex *clkPathPrev(const PathVertex *path, - PathVertex &tmp); + PathVertex clkPathPrev(const PathVertex *path); // For Search::reportArrivals. - PathVertex *clkPathPrev(Vertex *vertex, - int arrival_index, - PathVertex &tmp); + PathVertex clkPathPrev(Vertex *vertex, + int arrival_index); private: + PathVertex *clkPathPrev(const PathVertex *path, + PathVertex &tmp); Arrival otherMinMaxArrival(const PathVertex *path); void checkCrpr1(const Path *src_path, const PathVertex *tgt_clk_path, diff --git a/search/Search.cc b/search/Search.cc index e21a2279..949d542a 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -2745,10 +2745,9 @@ Search::reportArrivals(Vertex *vertex) const } report_->print(" %s", tag->asString(this)); if (tag_group->hasClkTag()) { - PathVertex tmp; - PathVertex *prev = check_crpr_->clkPathPrev(vertex, arrival_index, tmp); + PathVertex prev = check_crpr_->clkPathPrev(vertex, arrival_index); report_->print(" clk_prev=[%s]", - prev && !prev->isNull() ? prev->name(this) : "NULL"); + prev.isNull() ? "NULL" : prev.name(this)); } report_->print("\n"); }