Skip to content

Commit f6523bd

Browse files
committed
rm unique_ptr, default args
Signed-off-by: James Cherry <[email protected]>
1 parent 423c12c commit f6523bd

File tree

5 files changed

+50
-36
lines changed

5 files changed

+50
-36
lines changed

include/sta/Search.hh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public:
257257
const RiseFall *to_rf,
258258
const MinMax *min_max,
259259
const PathAnalysisPt *path_ap,
260-
TagSet *tag_cache = nullptr);
260+
TagSet *tag_cache);
261261
Tag *thruClkTag(Path *from_path,
262262
Vertex *from_vertex,
263263
Tag *from_tag,
@@ -333,7 +333,7 @@ public:
333333
bool is_segment_start,
334334
ExceptionStateSet *states,
335335
bool own_states,
336-
TagSet *tag_cache = nullptr);
336+
TagSet *tag_cache);
337337
void reportTags() const;
338338
void reportClkInfos() const;
339339
const ClkInfo *findClkInfo(const ClockEdge *clk_edge,
@@ -530,7 +530,7 @@ protected:
530530
InputDelay *to_input_delay,
531531
const MinMax *min_max,
532532
const PathAnalysisPt *path_ap,
533-
TagSet *tag_cache = nullptr);
533+
TagSet *tag_cache);
534534
ExceptionPath *exceptionTo(const Path *path,
535535
const Pin *pin,
536536
const RiseFall *rf,
@@ -704,12 +704,13 @@ class PathVisitor : public VertexVisitor, public StaState
704704
{
705705
public:
706706
// Uses search->evalPred() for search predicate.
707-
explicit PathVisitor(const StaState *sta);
707+
PathVisitor(const StaState *sta);
708708
PathVisitor(SearchPred *pred,
709+
bool make_tag_cache,
709710
const StaState *sta);
711+
virtual ~PathVisitor();
710712
virtual void visitFaninPaths(Vertex *to_vertex);
711713
virtual void visitFanoutPaths(Vertex *from_vertex);
712-
void initTagCache();
713714

714715
protected:
715716
// Return false to stop visiting.
@@ -756,15 +757,15 @@ protected:
756757
const MinMax *min_max,
757758
const PathAnalysisPt *path_ap) = 0;
758759
SearchPred *pred_;
759-
std::unique_ptr<TagSet> tag_cache_;
760+
TagSet *tag_cache_;
760761
};
761762

762763
// Visitor called during forward search to record an
763764
// arrival at an path.
764765
class ArrivalVisitor : public PathVisitor
765766
{
766767
public:
767-
explicit ArrivalVisitor(const StaState *sta);
768+
ArrivalVisitor(const StaState *sta);
768769
virtual ~ArrivalVisitor();
769770
// Initialize the visitor.
770771
// Defaults pred to search->eval_pred_.
@@ -838,12 +839,14 @@ protected:
838839
class RequiredVisitor : public PathVisitor
839840
{
840841
public:
841-
explicit RequiredVisitor(const StaState *sta);
842+
RequiredVisitor(const StaState *sta);
842843
virtual ~RequiredVisitor();
843844
virtual VertexVisitor *copy() const;
844845
virtual void visit(Vertex *vertex);
845846

846847
protected:
848+
RequiredVisitor(bool make_tag_cache,
849+
const StaState *sta);
847850
// Return false to stop visiting.
848851
virtual bool visitFromToPath(const Pin *from_pin,
849852
Vertex *from_vertex,

search/Genclks.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,7 @@ Genclks::makeTag(const Clock *gclk,
716716
nullptr, insert, 0.0, nullptr,
717717
path_ap, nullptr);
718718
return search_->findTag(master_rf, path_ap, clk_info, false,
719-
nullptr, false, states, true);
719+
nullptr, false, states, true, nullptr);
720720
}
721721

722722
class GenClkArrivalSearchPred : public EvalPred

search/Latches.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ Latches::latchOutArrival(const Path *data_path,
395395
en_clk_edge->transition(),
396396
MinMax::max(), false, states))
397397
q_tag = search_->findTag(q_rf, path_ap, q_clk_info, false,
398-
nullptr, false, states, true);
398+
nullptr, false, states, true, nullptr);
399399
}
400400
return;
401401
}

search/PathEnum.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ PathEnum::updatePathHeadDelays(PathSeq &paths,
686686
tag->isClock(),
687687
tag->inputDelay(),
688688
tag->isSegmentStart(),
689-
tag->states(), false);
689+
tag->states(), false, nullptr);
690690
path->setTag(updated_tag);
691691
}
692692
debugPrint(debug_, "path_enum", 5, "update arrival %s %s %s -> %s",

search/Search.cc

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ DynLoopSrchPred::hasPendingLoopPaths(Edge *edge,
147147
PathAPIndex path_ap_index = from_tag->pathAPIndex();
148148
PathAnalysisPt *path_ap = corners->findPathAnalysisPt(path_ap_index);
149149
Tag *to_tag = search->thruTag(from_tag, edge, RiseFall::rise(),
150-
path_ap->pathMinMax(), path_ap);
150+
path_ap->pathMinMax(), path_ap, nullptr);
151151
if (to_tag
152152
&& (prev_tag_group == nullptr
153153
|| !prev_tag_group->hasTag(from_tag)))
@@ -1106,7 +1106,7 @@ Search::findArrivalsSeed()
11061106
////////////////////////////////////////////////////////////////
11071107

11081108
ArrivalVisitor::ArrivalVisitor(const StaState *sta) :
1109-
PathVisitor(nullptr, sta)
1109+
PathVisitor(nullptr, false, sta)
11101110
{
11111111
init0();
11121112
init(true);
@@ -1116,7 +1116,7 @@ ArrivalVisitor::ArrivalVisitor(const StaState *sta) :
11161116
ArrivalVisitor::ArrivalVisitor(bool always_to_endpoints,
11171117
SearchPred *pred,
11181118
const StaState *sta) :
1119-
PathVisitor(pred, sta)
1119+
PathVisitor(pred, true, sta)
11201120
{
11211121
init0();
11221122
init(always_to_endpoints, pred);
@@ -1149,9 +1149,7 @@ ArrivalVisitor::init(bool always_to_endpoints,
11491149
VertexVisitor *
11501150
ArrivalVisitor::copy() const
11511151
{
1152-
auto visitor = new ArrivalVisitor(always_to_endpoints_, pred_, this);
1153-
visitor->initTagCache();
1154-
return visitor;
1152+
return new ArrivalVisitor(always_to_endpoints_, pred_, this);
11551153
}
11561154

11571155
ArrivalVisitor::~ArrivalVisitor()
@@ -1621,7 +1619,8 @@ Search::seedClkArrival(const Pin *pin,
16211619
// Only false_paths -from apply to clock tree pins.
16221620
ExceptionStateSet *states = nullptr;
16231621
sdc_->exceptionFromClkStates(pin,rf,clk,rf,min_max,states);
1624-
Tag *tag = findTag(rf, path_ap, clk_info, true, nullptr, false, states, true);
1622+
Tag *tag = findTag(rf, path_ap, clk_info, true, nullptr, false, states,
1623+
true, nullptr);
16251624
Arrival arrival(clk_edge->time() + insertion);
16261625
tag_bldr->setArrival(tag, arrival);
16271626
}
@@ -1659,7 +1658,8 @@ Search::clkDataTag(const Pin *pin,
16591658
|| sdc_->isPropagatedClock(pin));
16601659
const ClkInfo *clk_info = findClkInfo(clk_edge, pin, is_propagated,
16611660
insertion, path_ap);
1662-
return findTag(rf, path_ap, clk_info, false, nullptr, false, states, true);
1661+
return findTag(rf, path_ap, clk_info, false, nullptr, false, states,
1662+
true, nullptr);
16631663
}
16641664
else
16651665
return nullptr;
@@ -2020,40 +2020,44 @@ Search::inputDelayTag(const Pin *pin,
20202020
false, nullptr, clk_insertion, clk_latency,
20212021
clk_uncertainties, path_ap, nullptr);
20222022
tag = findTag(rf, path_ap, clk_info, false, input_delay, is_segment_start,
2023-
states, true);
2023+
states, true, nullptr);
20242024
}
20252025

20262026
if (tag) {
20272027
const ClkInfo *clk_info = tag->clkInfo();
20282028
// Check for state changes on existing tag exceptions (pending -thru pins).
20292029
tag = mutateTag(tag, pin, rf, false, clk_info,
20302030
pin, rf, false, false, is_segment_start, clk_info,
2031-
input_delay, min_max, path_ap);
2031+
input_delay, min_max, path_ap, nullptr);
20322032
}
20332033
return tag;
20342034
}
20352035

20362036
////////////////////////////////////////////////////////////////
20372037

20382038
PathVisitor::PathVisitor(const StaState *sta) :
2039+
20392040
StaState(sta),
20402041
pred_(sta->search()->evalPred()),
2041-
tag_cache_(nullptr)
2042+
tag_cache_( nullptr)
20422043
{
20432044
}
20442045

20452046
PathVisitor::PathVisitor(SearchPred *pred,
2047+
bool make_tag_cache,
20462048
const StaState *sta) :
2049+
20472050
StaState(sta),
20482051
pred_(pred),
2049-
tag_cache_(nullptr)
2052+
tag_cache_(make_tag_cache
2053+
? new TagSet(128, TagSet::hasher(sta), TagSet::key_equal(sta))
2054+
: nullptr)
20502055
{
20512056
}
20522057

2053-
void
2054-
PathVisitor::initTagCache()
2058+
PathVisitor::~PathVisitor()
20552059
{
2056-
tag_cache_ = std::make_unique<TagSet>(128, TagSet::hasher(this), TagSet::key_equal(this));
2060+
delete tag_cache_;
20572061
}
20582062

20592063
void
@@ -2243,7 +2247,7 @@ PathVisitor::visitFromPath(const Pin *from_pin,
22432247
to_clk_info, to_pin, to_rf, min_max,
22442248
path_ap);
22452249
if (to_tag)
2246-
to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap, tag_cache_.get());
2250+
to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap, tag_cache_);
22472251
from_arrival = search_->clkPathArrival(from_path, from_clk_info,
22482252
clk_edge, min_max, path_ap);
22492253
to_arrival = from_arrival + arc_delay;
@@ -2259,7 +2263,7 @@ PathVisitor::visitFromPath(const Pin *from_pin,
22592263
latches_->latchOutArrival(from_path, arc, edge, path_ap,
22602264
to_tag, arc_delay, to_arrival);
22612265
if (to_tag)
2262-
to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap, tag_cache_.get());
2266+
to_tag = search_->thruTag(to_tag, edge, to_rf, min_max, path_ap, tag_cache_);
22632267
}
22642268
}
22652269
else if (from_tag->isClock()) {
@@ -2298,7 +2302,7 @@ PathVisitor::visitFromPath(const Pin *from_pin,
22982302
else {
22992303
if (!(sdc_->isPathDelayInternalFromBreak(to_pin)
23002304
|| sdc_->isPathDelayInternalToBreak(from_pin))) {
2301-
to_tag = search_->thruTag(from_tag, edge, to_rf, min_max, path_ap, tag_cache_.get());
2305+
to_tag = search_->thruTag(from_tag, edge, to_rf, min_max, path_ap, tag_cache_);
23022306
arc_delay = search_->deratedDelay(from_vertex, arc, edge, false, path_ap);
23032307
if (!delayInf(arc_delay))
23042308
to_arrival = from_arrival + arc_delay;
@@ -2408,7 +2412,7 @@ Search::fromUnclkedInputTag(const Pin *pin,
24082412
&& (!require_exception || states)) {
24092413
const ClkInfo *clk_info = findClkInfo(nullptr, nullptr, false, 0.0, path_ap);
24102414
return findTag(rf, path_ap, clk_info, false, nullptr,
2411-
is_segment_start, states, true);
2415+
is_segment_start, states, true, nullptr);
24122416
}
24132417
return nullptr;
24142418
}
@@ -2429,7 +2433,8 @@ Search::fromRegClkTag(const Pin *from_pin,
24292433
min_max, states)) {
24302434
// Hack for filter -from reg/Q.
24312435
sdc_->filterRegQStates(to_pin, to_rf, min_max, states);
2432-
return findTag(to_rf, path_ap, clk_info, false, nullptr, false, states, true);
2436+
return findTag(to_rf, path_ap, clk_info, false, nullptr, false, states,
2437+
true, nullptr);
24332438
}
24342439
else
24352440
return nullptr;
@@ -2510,7 +2515,7 @@ Search::thruClkTag(Path *from_path,
25102515
arc_delay_min_max_eq, min_max, path_ap);
25112516
Tag *to_tag = mutateTag(from_tag,from_pin,from_rf,from_is_clk,from_clk_info,
25122517
to_pin, to_rf, to_is_clk, to_is_reg_clk, false,
2513-
to_clk_info, nullptr, min_max, path_ap);
2518+
to_clk_info, nullptr, min_max, path_ap, nullptr);
25142519
return to_tag;
25152520
}
25162521

@@ -2996,7 +3001,7 @@ Search::findTag(const RiseFall *rf,
29963001
Tag probe(0, rf->index(), path_ap->index(), clk_info, is_clk, input_delay,
29973002
is_segment_start, states, false, this);
29983003
if (tag_cache) {
2999-
auto tag = tag_cache->findKey(&probe);
3004+
Tag *tag = tag_cache->findKey(&probe);
30003005
if (tag)
30013006
return tag;
30023007
}
@@ -3553,6 +3558,14 @@ RequiredVisitor::RequiredVisitor(const StaState *sta) :
35533558
{
35543559
}
35553560

3561+
RequiredVisitor::RequiredVisitor(bool make_tag_cache,
3562+
const StaState *sta) :
3563+
PathVisitor(sta->search()->evalPred(), make_tag_cache, sta),
3564+
required_cmp_(new RequiredCmp),
3565+
visit_path_ends_(new VisitPathEnds(sta))
3566+
{
3567+
}
3568+
35563569
RequiredVisitor::~RequiredVisitor()
35573570
{
35583571
delete required_cmp_;
@@ -3562,9 +3575,7 @@ RequiredVisitor::~RequiredVisitor()
35623575
VertexVisitor *
35633576
RequiredVisitor::copy() const
35643577
{
3565-
auto visitor = new RequiredVisitor(this);
3566-
visitor->initTagCache();
3567-
return visitor;
3578+
return new RequiredVisitor(true, this);
35683579
}
35693580

35703581
void

0 commit comments

Comments
 (0)