@@ -1149,7 +1149,9 @@ ArrivalVisitor::init(bool always_to_endpoints,
11491149VertexVisitor *
11501150ArrivalVisitor::copy () const
11511151{
1152- return new ArrivalVisitor (always_to_endpoints_, pred_, this );
1152+ auto visitor = new ArrivalVisitor (always_to_endpoints_, pred_, this );
1153+ visitor->initTagCache ();
1154+ return visitor;
11531155}
11541156
11551157ArrivalVisitor::~ArrivalVisitor ()
@@ -2035,17 +2037,25 @@ Search::inputDelayTag(const Pin *pin,
20352037
20362038PathVisitor::PathVisitor (const StaState *sta) :
20372039 StaState (sta),
2038- pred_ (sta->search ()->evalPred())
2040+ pred_ (sta->search ()->evalPred()),
2041+ tag_cache_(nullptr )
20392042{
20402043}
20412044
20422045PathVisitor::PathVisitor (SearchPred *pred,
20432046 const StaState *sta) :
20442047 StaState(sta),
2045- pred_(pred)
2048+ pred_(pred),
2049+ tag_cache_(nullptr )
20462050{
20472051}
20482052
2053+ void
2054+ PathVisitor::initTagCache ()
2055+ {
2056+ tag_cache_ = std::make_unique<TagSet>(128 , TagSet::hasher (this ), TagSet::key_equal (this ));
2057+ }
2058+
20492059void
20502060PathVisitor::visitFaninPaths (Vertex *to_vertex)
20512061{
@@ -2233,8 +2243,8 @@ PathVisitor::visitFromPath(const Pin *from_pin,
22332243 to_clk_info, to_pin, to_rf, min_max,
22342244 path_ap);
22352245 if (to_tag)
2236- to_tag = search_->thruTag (to_tag, edge, to_rf, min_max, path_ap);
2237- from_arrival = search_->clkPathArrival (from_path, from_clk_info,
2246+ to_tag = search_->thruTag (to_tag, edge, to_rf, min_max, path_ap, tag_cache_. get () );
2247+ from_arrival = search_->clkPathArrival (from_path, from_clk_info,
22382248 clk_edge, min_max, path_ap);
22392249 to_arrival = from_arrival + arc_delay;
22402250 }
@@ -2249,7 +2259,7 @@ PathVisitor::visitFromPath(const Pin *from_pin,
22492259 latches_->latchOutArrival (from_path, arc, edge, path_ap,
22502260 to_tag, arc_delay, to_arrival);
22512261 if (to_tag)
2252- to_tag = search_->thruTag (to_tag, edge, to_rf, min_max, path_ap);
2262+ to_tag = search_->thruTag (to_tag, edge, to_rf, min_max, path_ap, tag_cache_. get () );
22532263 }
22542264 }
22552265 else if (from_tag->isClock ()) {
@@ -2288,7 +2298,7 @@ PathVisitor::visitFromPath(const Pin *from_pin,
22882298 else {
22892299 if (!(sdc_->isPathDelayInternalFromBreak (to_pin)
22902300 || sdc_->isPathDelayInternalToBreak (from_pin))) {
2291- to_tag = search_->thruTag (from_tag, edge, to_rf, min_max, path_ap);
2301+ to_tag = search_->thruTag (from_tag, edge, to_rf, min_max, path_ap, tag_cache_. get () );
22922302 arc_delay = search_->deratedDelay (from_vertex, arc, edge, false , path_ap);
22932303 if (!delayInf (arc_delay))
22942304 to_arrival = from_arrival + arc_delay;
@@ -2450,10 +2460,11 @@ Search::clkInfoWithCrprClkPath(const ClkInfo *from_clk_info,
24502460// Return nullptr if the result tag completes a false path.
24512461Tag *
24522462Search::thruTag (Tag *from_tag,
2453- Edge *edge,
2454- const RiseFall *to_rf,
2455- const MinMax *min_max,
2456- const PathAnalysisPt *path_ap)
2463+ Edge *edge,
2464+ const RiseFall *to_rf,
2465+ const MinMax *min_max,
2466+ const PathAnalysisPt *path_ap,
2467+ TagSet *tag_cache)
24572468{
24582469 const Pin *from_pin = edge->from (graph_)->pin ();
24592470 Vertex *to_vertex = edge->to (graph_);
@@ -2462,9 +2473,10 @@ Search::thruTag(Tag *from_tag,
24622473 const ClkInfo *from_clk_info = from_tag->clkInfo ();
24632474 bool to_is_reg_clk = to_vertex->isRegClk ();
24642475 Tag *to_tag = mutateTag (from_tag, from_pin, from_rf, false , from_clk_info,
2465- to_pin, to_rf, false , to_is_reg_clk, false ,
2466- // input delay is not propagated.
2467- from_clk_info, nullptr , min_max, path_ap);
2476+ to_pin, to_rf, false , to_is_reg_clk, false ,
2477+ // input delay is not propagated.
2478+ from_clk_info, nullptr , min_max, path_ap,
2479+ tag_cache);
24682480 return to_tag;
24692481}
24702482
@@ -2617,19 +2629,20 @@ Search::thruClkInfo(Path *from_path,
26172629// Find the tag for a path going from from_tag thru edge to to_pin.
26182630Tag *
26192631Search::mutateTag (Tag *from_tag,
2620- const Pin *from_pin,
2621- const RiseFall *from_rf,
2622- bool from_is_clk,
2623- const ClkInfo *from_clk_info,
2624- const Pin *to_pin,
2625- const RiseFall *to_rf,
2626- bool to_is_clk,
2627- bool to_is_reg_clk,
2628- bool to_is_segment_start,
2629- const ClkInfo *to_clk_info,
2630- InputDelay *to_input_delay,
2631- const MinMax *min_max,
2632- const PathAnalysisPt *path_ap)
2632+ const Pin *from_pin,
2633+ const RiseFall *from_rf,
2634+ bool from_is_clk,
2635+ const ClkInfo *from_clk_info,
2636+ const Pin *to_pin,
2637+ const RiseFall *to_rf,
2638+ bool to_is_clk,
2639+ bool to_is_reg_clk,
2640+ bool to_is_segment_start,
2641+ const ClkInfo *to_clk_info,
2642+ InputDelay *to_input_delay,
2643+ const MinMax *min_max,
2644+ const PathAnalysisPt *path_ap,
2645+ TagSet *tag_cache)
26332646{
26342647 ExceptionStateSet *new_states = nullptr ;
26352648 ExceptionStateSet *from_states = from_tag->states ();
@@ -2713,8 +2726,8 @@ Search::mutateTag(Tag *from_tag,
27132726
27142727 if (new_states)
27152728 return findTag (to_rf, path_ap, to_clk_info, to_is_clk,
2716- from_tag->inputDelay (), to_is_segment_start,
2717- new_states, true );
2729+ from_tag->inputDelay (), to_is_segment_start, new_states ,
2730+ true , tag_cache );
27182731 else {
27192732 // No state change.
27202733 if (to_clk_info == from_clk_info
@@ -2724,9 +2737,8 @@ Search::mutateTag(Tag *from_tag,
27242737 && from_tag->inputDelay () == to_input_delay)
27252738 return from_tag;
27262739 else
2727- return findTag (to_rf, path_ap, to_clk_info, to_is_clk,
2728- to_input_delay, to_is_segment_start,
2729- from_states, false );
2740+ return findTag (to_rf, path_ap, to_clk_info, to_is_clk, to_input_delay,
2741+ to_is_segment_start, from_states, false , tag_cache);
27302742 }
27312743}
27322744
@@ -2972,16 +2984,22 @@ Search::tagCount() const
29722984
29732985Tag *
29742986Search::findTag (const RiseFall *rf,
2975- const PathAnalysisPt *path_ap,
2976- const ClkInfo *clk_info,
2977- bool is_clk,
2978- InputDelay *input_delay,
2979- bool is_segment_start,
2980- ExceptionStateSet *states,
2981- bool own_states)
2987+ const PathAnalysisPt *path_ap,
2988+ const ClkInfo *clk_info,
2989+ bool is_clk,
2990+ InputDelay *input_delay,
2991+ bool is_segment_start,
2992+ ExceptionStateSet *states,
2993+ bool own_states,
2994+ TagSet *tag_cache)
29822995{
29832996 Tag probe (0 , rf->index (), path_ap->index (), clk_info, is_clk, input_delay,
29842997 is_segment_start, states, false , this );
2998+ if (tag_cache) {
2999+ auto tag = tag_cache->findKey (&probe);
3000+ if (tag)
3001+ return tag;
3002+ }
29853003 LockGuard lock (tag_lock_);
29863004 Tag *tag = tag_set_->findKey (&probe);
29873005 if (tag == nullptr ) {
@@ -3019,6 +3037,10 @@ Search::findTag(const RiseFall *rf,
30193037 }
30203038 if (own_states)
30213039 delete states;
3040+
3041+ if (tag_cache)
3042+ tag_cache->insert (tag);
3043+
30223044 return tag;
30233045}
30243046
@@ -3540,7 +3562,9 @@ RequiredVisitor::~RequiredVisitor()
35403562VertexVisitor *
35413563RequiredVisitor::copy () const
35423564{
3543- return new RequiredVisitor (this );
3565+ auto visitor = new RequiredVisitor (this );
3566+ visitor->initTagCache ();
3567+ return visitor;
35443568}
35453569
35463570void
0 commit comments