rm unique_ptr, default args

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2025-11-04 09:45:20 -07:00
parent 423c12c8f9
commit f6523bd9c6
5 changed files with 50 additions and 36 deletions

View File

@ -257,7 +257,7 @@ public:
const RiseFall *to_rf, const RiseFall *to_rf,
const MinMax *min_max, const MinMax *min_max,
const PathAnalysisPt *path_ap, const PathAnalysisPt *path_ap,
TagSet *tag_cache = nullptr); TagSet *tag_cache);
Tag *thruClkTag(Path *from_path, Tag *thruClkTag(Path *from_path,
Vertex *from_vertex, Vertex *from_vertex,
Tag *from_tag, Tag *from_tag,
@ -333,7 +333,7 @@ public:
bool is_segment_start, bool is_segment_start,
ExceptionStateSet *states, ExceptionStateSet *states,
bool own_states, bool own_states,
TagSet *tag_cache = nullptr); TagSet *tag_cache);
void reportTags() const; void reportTags() const;
void reportClkInfos() const; void reportClkInfos() const;
const ClkInfo *findClkInfo(const ClockEdge *clk_edge, const ClkInfo *findClkInfo(const ClockEdge *clk_edge,
@ -530,7 +530,7 @@ protected:
InputDelay *to_input_delay, InputDelay *to_input_delay,
const MinMax *min_max, const MinMax *min_max,
const PathAnalysisPt *path_ap, const PathAnalysisPt *path_ap,
TagSet *tag_cache = nullptr); TagSet *tag_cache);
ExceptionPath *exceptionTo(const Path *path, ExceptionPath *exceptionTo(const Path *path,
const Pin *pin, const Pin *pin,
const RiseFall *rf, const RiseFall *rf,
@ -704,12 +704,13 @@ class PathVisitor : public VertexVisitor, public StaState
{ {
public: public:
// Uses search->evalPred() for search predicate. // Uses search->evalPred() for search predicate.
explicit PathVisitor(const StaState *sta); PathVisitor(const StaState *sta);
PathVisitor(SearchPred *pred, PathVisitor(SearchPred *pred,
bool make_tag_cache,
const StaState *sta); const StaState *sta);
virtual ~PathVisitor();
virtual void visitFaninPaths(Vertex *to_vertex); virtual void visitFaninPaths(Vertex *to_vertex);
virtual void visitFanoutPaths(Vertex *from_vertex); virtual void visitFanoutPaths(Vertex *from_vertex);
void initTagCache();
protected: protected:
// Return false to stop visiting. // Return false to stop visiting.
@ -756,7 +757,7 @@ protected:
const MinMax *min_max, const MinMax *min_max,
const PathAnalysisPt *path_ap) = 0; const PathAnalysisPt *path_ap) = 0;
SearchPred *pred_; SearchPred *pred_;
std::unique_ptr<TagSet> tag_cache_; TagSet *tag_cache_;
}; };
// Visitor called during forward search to record an // Visitor called during forward search to record an
@ -764,7 +765,7 @@ protected:
class ArrivalVisitor : public PathVisitor class ArrivalVisitor : public PathVisitor
{ {
public: public:
explicit ArrivalVisitor(const StaState *sta); ArrivalVisitor(const StaState *sta);
virtual ~ArrivalVisitor(); virtual ~ArrivalVisitor();
// Initialize the visitor. // Initialize the visitor.
// Defaults pred to search->eval_pred_. // Defaults pred to search->eval_pred_.
@ -838,12 +839,14 @@ protected:
class RequiredVisitor : public PathVisitor class RequiredVisitor : public PathVisitor
{ {
public: public:
explicit RequiredVisitor(const StaState *sta); RequiredVisitor(const StaState *sta);
virtual ~RequiredVisitor(); virtual ~RequiredVisitor();
virtual VertexVisitor *copy() const; virtual VertexVisitor *copy() const;
virtual void visit(Vertex *vertex); virtual void visit(Vertex *vertex);
protected: protected:
RequiredVisitor(bool make_tag_cache,
const StaState *sta);
// Return false to stop visiting. // Return false to stop visiting.
virtual bool visitFromToPath(const Pin *from_pin, virtual bool visitFromToPath(const Pin *from_pin,
Vertex *from_vertex, Vertex *from_vertex,

View File

@ -716,7 +716,7 @@ Genclks::makeTag(const Clock *gclk,
nullptr, insert, 0.0, nullptr, nullptr, insert, 0.0, nullptr,
path_ap, nullptr); path_ap, nullptr);
return search_->findTag(master_rf, path_ap, clk_info, false, return search_->findTag(master_rf, path_ap, clk_info, false,
nullptr, false, states, true); nullptr, false, states, true, nullptr);
} }
class GenClkArrivalSearchPred : public EvalPred class GenClkArrivalSearchPred : public EvalPred

View File

@ -395,7 +395,7 @@ Latches::latchOutArrival(const Path *data_path,
en_clk_edge->transition(), en_clk_edge->transition(),
MinMax::max(), false, states)) MinMax::max(), false, states))
q_tag = search_->findTag(q_rf, path_ap, q_clk_info, false, q_tag = search_->findTag(q_rf, path_ap, q_clk_info, false,
nullptr, false, states, true); nullptr, false, states, true, nullptr);
} }
return; return;
} }

View File

@ -686,7 +686,7 @@ PathEnum::updatePathHeadDelays(PathSeq &paths,
tag->isClock(), tag->isClock(),
tag->inputDelay(), tag->inputDelay(),
tag->isSegmentStart(), tag->isSegmentStart(),
tag->states(), false); tag->states(), false, nullptr);
path->setTag(updated_tag); path->setTag(updated_tag);
} }
debugPrint(debug_, "path_enum", 5, "update arrival %s %s %s -> %s", debugPrint(debug_, "path_enum", 5, "update arrival %s %s %s -> %s",

View File

@ -147,7 +147,7 @@ DynLoopSrchPred::hasPendingLoopPaths(Edge *edge,
PathAPIndex path_ap_index = from_tag->pathAPIndex(); PathAPIndex path_ap_index = from_tag->pathAPIndex();
PathAnalysisPt *path_ap = corners->findPathAnalysisPt(path_ap_index); PathAnalysisPt *path_ap = corners->findPathAnalysisPt(path_ap_index);
Tag *to_tag = search->thruTag(from_tag, edge, RiseFall::rise(), Tag *to_tag = search->thruTag(from_tag, edge, RiseFall::rise(),
path_ap->pathMinMax(), path_ap); path_ap->pathMinMax(), path_ap, nullptr);
if (to_tag if (to_tag
&& (prev_tag_group == nullptr && (prev_tag_group == nullptr
|| !prev_tag_group->hasTag(from_tag))) || !prev_tag_group->hasTag(from_tag)))
@ -1106,7 +1106,7 @@ Search::findArrivalsSeed()
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
ArrivalVisitor::ArrivalVisitor(const StaState *sta) : ArrivalVisitor::ArrivalVisitor(const StaState *sta) :
PathVisitor(nullptr, sta) PathVisitor(nullptr, false, sta)
{ {
init0(); init0();
init(true); init(true);
@ -1116,7 +1116,7 @@ ArrivalVisitor::ArrivalVisitor(const StaState *sta) :
ArrivalVisitor::ArrivalVisitor(bool always_to_endpoints, ArrivalVisitor::ArrivalVisitor(bool always_to_endpoints,
SearchPred *pred, SearchPred *pred,
const StaState *sta) : const StaState *sta) :
PathVisitor(pred, sta) PathVisitor(pred, true, sta)
{ {
init0(); init0();
init(always_to_endpoints, pred); init(always_to_endpoints, pred);
@ -1149,9 +1149,7 @@ ArrivalVisitor::init(bool always_to_endpoints,
VertexVisitor * VertexVisitor *
ArrivalVisitor::copy() const ArrivalVisitor::copy() const
{ {
auto visitor = new ArrivalVisitor(always_to_endpoints_, pred_, this); return new ArrivalVisitor(always_to_endpoints_, pred_, this);
visitor->initTagCache();
return visitor;
} }
ArrivalVisitor::~ArrivalVisitor() ArrivalVisitor::~ArrivalVisitor()
@ -1621,7 +1619,8 @@ Search::seedClkArrival(const Pin *pin,
// Only false_paths -from apply to clock tree pins. // Only false_paths -from apply to clock tree pins.
ExceptionStateSet *states = nullptr; ExceptionStateSet *states = nullptr;
sdc_->exceptionFromClkStates(pin,rf,clk,rf,min_max,states); sdc_->exceptionFromClkStates(pin,rf,clk,rf,min_max,states);
Tag *tag = findTag(rf, path_ap, clk_info, true, nullptr, false, states, true); Tag *tag = findTag(rf, path_ap, clk_info, true, nullptr, false, states,
true, nullptr);
Arrival arrival(clk_edge->time() + insertion); Arrival arrival(clk_edge->time() + insertion);
tag_bldr->setArrival(tag, arrival); tag_bldr->setArrival(tag, arrival);
} }
@ -1659,7 +1658,8 @@ Search::clkDataTag(const Pin *pin,
|| sdc_->isPropagatedClock(pin)); || sdc_->isPropagatedClock(pin));
const ClkInfo *clk_info = findClkInfo(clk_edge, pin, is_propagated, const ClkInfo *clk_info = findClkInfo(clk_edge, pin, is_propagated,
insertion, path_ap); insertion, path_ap);
return findTag(rf, path_ap, clk_info, false, nullptr, false, states, true); return findTag(rf, path_ap, clk_info, false, nullptr, false, states,
true, nullptr);
} }
else else
return nullptr; return nullptr;
@ -2020,7 +2020,7 @@ Search::inputDelayTag(const Pin *pin,
false, nullptr, clk_insertion, clk_latency, false, nullptr, clk_insertion, clk_latency,
clk_uncertainties, path_ap, nullptr); clk_uncertainties, path_ap, nullptr);
tag = findTag(rf, path_ap, clk_info, false, input_delay, is_segment_start, tag = findTag(rf, path_ap, clk_info, false, input_delay, is_segment_start,
states, true); states, true, nullptr);
} }
if (tag) { if (tag) {
@ -2028,7 +2028,7 @@ Search::inputDelayTag(const Pin *pin,
// Check for state changes on existing tag exceptions (pending -thru pins). // Check for state changes on existing tag exceptions (pending -thru pins).
tag = mutateTag(tag, pin, rf, false, clk_info, tag = mutateTag(tag, pin, rf, false, clk_info,
pin, rf, false, false, is_segment_start, clk_info, pin, rf, false, false, is_segment_start, clk_info,
input_delay, min_max, path_ap); input_delay, min_max, path_ap, nullptr);
} }
return tag; return tag;
} }
@ -2036,6 +2036,7 @@ Search::inputDelayTag(const Pin *pin,
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
PathVisitor::PathVisitor(const StaState *sta) : PathVisitor::PathVisitor(const StaState *sta) :
StaState(sta), StaState(sta),
pred_(sta->search()->evalPred()), pred_(sta->search()->evalPred()),
tag_cache_( nullptr) tag_cache_( nullptr)
@ -2043,17 +2044,20 @@ PathVisitor::PathVisitor(const StaState *sta) :
} }
PathVisitor::PathVisitor(SearchPred *pred, PathVisitor::PathVisitor(SearchPred *pred,
bool make_tag_cache,
const StaState *sta) : const StaState *sta) :
StaState(sta), StaState(sta),
pred_(pred), pred_(pred),
tag_cache_(nullptr) tag_cache_(make_tag_cache
? new TagSet(128, TagSet::hasher(sta), TagSet::key_equal(sta))
: nullptr)
{ {
} }
void PathVisitor::~PathVisitor()
PathVisitor::initTagCache()
{ {
tag_cache_ = std::make_unique<TagSet>(128, TagSet::hasher(this), TagSet::key_equal(this)); delete tag_cache_;
} }
void void
@ -2243,7 +2247,7 @@ PathVisitor::visitFromPath(const Pin *from_pin,
to_clk_info, to_pin, to_rf, min_max, to_clk_info, to_pin, to_rf, min_max,
path_ap); path_ap);
if (to_tag) if (to_tag)
to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap, tag_cache_.get()); to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap, tag_cache_);
from_arrival = search_->clkPathArrival(from_path, from_clk_info, from_arrival = search_->clkPathArrival(from_path, from_clk_info,
clk_edge, min_max, path_ap); clk_edge, min_max, path_ap);
to_arrival = from_arrival + arc_delay; to_arrival = from_arrival + arc_delay;
@ -2259,7 +2263,7 @@ PathVisitor::visitFromPath(const Pin *from_pin,
latches_->latchOutArrival(from_path, arc, edge, path_ap, latches_->latchOutArrival(from_path, arc, edge, path_ap,
to_tag, arc_delay, to_arrival); to_tag, arc_delay, to_arrival);
if (to_tag) if (to_tag)
to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap, tag_cache_.get()); to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap, tag_cache_);
} }
} }
else if (from_tag->isClock()) { else if (from_tag->isClock()) {
@ -2298,7 +2302,7 @@ PathVisitor::visitFromPath(const Pin *from_pin,
else { else {
if (!(sdc_->isPathDelayInternalFromBreak(to_pin) if (!(sdc_->isPathDelayInternalFromBreak(to_pin)
|| sdc_->isPathDelayInternalToBreak(from_pin))) { || sdc_->isPathDelayInternalToBreak(from_pin))) {
to_tag = search_->thruTag(from_tag, edge, to_rf, min_max, path_ap, tag_cache_.get()); to_tag = search_->thruTag(from_tag, edge, to_rf, min_max, path_ap, tag_cache_);
arc_delay = search_->deratedDelay(from_vertex, arc, edge, false, path_ap); arc_delay = search_->deratedDelay(from_vertex, arc, edge, false, path_ap);
if (!delayInf(arc_delay)) if (!delayInf(arc_delay))
to_arrival = from_arrival + arc_delay; to_arrival = from_arrival + arc_delay;
@ -2408,7 +2412,7 @@ Search::fromUnclkedInputTag(const Pin *pin,
&& (!require_exception || states)) { && (!require_exception || states)) {
const ClkInfo *clk_info = findClkInfo(nullptr, nullptr, false, 0.0, path_ap); const ClkInfo *clk_info = findClkInfo(nullptr, nullptr, false, 0.0, path_ap);
return findTag(rf, path_ap, clk_info, false, nullptr, return findTag(rf, path_ap, clk_info, false, nullptr,
is_segment_start, states, true); is_segment_start, states, true, nullptr);
} }
return nullptr; return nullptr;
} }
@ -2429,7 +2433,8 @@ Search::fromRegClkTag(const Pin *from_pin,
min_max, states)) { min_max, states)) {
// Hack for filter -from reg/Q. // Hack for filter -from reg/Q.
sdc_->filterRegQStates(to_pin, to_rf, min_max, states); sdc_->filterRegQStates(to_pin, to_rf, min_max, states);
return findTag(to_rf, path_ap, clk_info, false, nullptr, false, states, true); return findTag(to_rf, path_ap, clk_info, false, nullptr, false, states,
true, nullptr);
} }
else else
return nullptr; return nullptr;
@ -2510,7 +2515,7 @@ Search::thruClkTag(Path *from_path,
arc_delay_min_max_eq, min_max, path_ap); arc_delay_min_max_eq, min_max, path_ap);
Tag *to_tag = mutateTag(from_tag,from_pin,from_rf,from_is_clk,from_clk_info, Tag *to_tag = mutateTag(from_tag,from_pin,from_rf,from_is_clk,from_clk_info,
to_pin, to_rf, to_is_clk, to_is_reg_clk, false, to_pin, to_rf, to_is_clk, to_is_reg_clk, false,
to_clk_info, nullptr, min_max, path_ap); to_clk_info, nullptr, min_max, path_ap, nullptr);
return to_tag; return to_tag;
} }
@ -2996,7 +3001,7 @@ Search::findTag(const RiseFall *rf,
Tag probe(0, rf->index(), path_ap->index(), clk_info, is_clk, input_delay, Tag probe(0, rf->index(), path_ap->index(), clk_info, is_clk, input_delay,
is_segment_start, states, false, this); is_segment_start, states, false, this);
if (tag_cache) { if (tag_cache) {
auto tag = tag_cache->findKey(&probe); Tag *tag = tag_cache->findKey(&probe);
if (tag) if (tag)
return tag; return tag;
} }
@ -3553,6 +3558,14 @@ RequiredVisitor::RequiredVisitor(const StaState *sta) :
{ {
} }
RequiredVisitor::RequiredVisitor(bool make_tag_cache,
const StaState *sta) :
PathVisitor(sta->search()->evalPred(), make_tag_cache, sta),
required_cmp_(new RequiredCmp),
visit_path_ends_(new VisitPathEnds(sta))
{
}
RequiredVisitor::~RequiredVisitor() RequiredVisitor::~RequiredVisitor()
{ {
delete required_cmp_; delete required_cmp_;
@ -3562,9 +3575,7 @@ RequiredVisitor::~RequiredVisitor()
VertexVisitor * VertexVisitor *
RequiredVisitor::copy() const RequiredVisitor::copy() const
{ {
auto visitor = new RequiredVisitor(this); return new RequiredVisitor(true, this);
visitor->initTagCache();
return visitor;
} }
void void