From 099936561d0f8f949163881fb3ad52f12b077a73 Mon Sep 17 00:00:00 2001 From: James Cherry Date: Thu, 29 Jun 2023 17:06:07 -0700 Subject: [PATCH] rvo Signed-off-by: James Cherry --- include/sta/ExceptionPath.hh | 9 +++------ sdc/ExceptionPath.cc | 25 ++++++++++++++----------- search/PathGroup.cc | 3 +-- search/Search.cc | 3 +-- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/include/sta/ExceptionPath.hh b/include/sta/ExceptionPath.hh index 75d7f287..4ea98699 100644 --- a/include/sta/ExceptionPath.hh +++ b/include/sta/ExceptionPath.hh @@ -322,8 +322,7 @@ public: virtual void mergeInto(ExceptionPt *pt, const Network *network) = 0; // All pins and instance/net pins. - virtual void allPins(const Network *network, - PinSet *pins) = 0; + virtual PinSet allPins(const Network *network) = 0; virtual int typePriority() const = 0; virtual const char *asString(const Network *network) const = 0; virtual size_t objectCount() const = 0; @@ -378,8 +377,7 @@ public: bool hasObjects() const; void deleteObjects(ExceptionFromTo *pt, const Network *network); - virtual void allPins(const Network *network, - PinSet *pins); + virtual PinSet allPins(const Network *network); bool equal(ExceptionFromTo *from_to) const; virtual int compare(ExceptionPt *pt, const Network *network) const; @@ -505,8 +503,7 @@ public: bool hasObjects() const; void deleteObjects(ExceptionThru *pt, const Network *network); - virtual void allPins(const Network *network, - PinSet *pins); + virtual PinSet allPins(const Network *network); bool matches(const Pin *from_pin, const Pin *to_pin, const RiseFall *to_rf, diff --git a/sdc/ExceptionPath.cc b/sdc/ExceptionPath.cc index ed885a69..9cf06ec9 100644 --- a/sdc/ExceptionPath.cc +++ b/sdc/ExceptionPath.cc @@ -1,3 +1,4 @@ + // OpenSTA, Static Timing Analyzer // Copyright (c) 2023, Parallax Software, Inc. // @@ -933,24 +934,25 @@ ExceptionFromTo::hasObjects() const return hasPins() || hasClocks() || hasInstances(); } -void -ExceptionFromTo::allPins(const Network *network, - PinSet *pins) +PinSet +ExceptionFromTo::allPins(const Network *network) { + PinSet pins(network); if (pins_) { for (const Pin *pin : *pins_) - pins->insert(pin); + pins.insert(pin); } if (insts_) { for (const Instance *inst : *insts_) { InstancePinIterator *pin_iter = network->pinIterator(inst); while (pin_iter->hasNext()) { const Pin *pin = pin_iter->next(); - pins->insert(pin); + pins.insert(pin); } delete pin_iter; } } + return pins; } void @@ -1777,20 +1779,20 @@ ExceptionThru::deleteEdge(const EdgePins &edge) edges_->erase(edge); } -void -ExceptionThru::allPins(const Network *network, - PinSet *pins) +PinSet +ExceptionThru::allPins(const Network *network) { + PinSet pins(network); if (pins_) { for (const Pin *pin : *pins_) - pins->insert(pin); + pins.insert(pin); } if (insts_) { for (const Instance *inst : *insts_) { InstancePinIterator *pin_iter = network->pinIterator(inst); while (pin_iter->hasNext()) { Pin *pin = pin_iter->next(); - pins->insert(pin); + pins.insert(pin); } delete pin_iter; } @@ -1800,11 +1802,12 @@ ExceptionThru::allPins(const Network *network, NetConnectedPinIterator *pin_iter = network->connectedPinIterator(net); while (pin_iter->hasNext()) { const Pin *pin = pin_iter->next(); - pins->insert(pin); + pins.insert(pin); } delete pin_iter; } } + return pins; } bool diff --git a/search/PathGroup.cc b/search/PathGroup.cc index 9f88baa6..d7b75041 100644 --- a/search/PathGroup.cc +++ b/search/PathGroup.cc @@ -800,8 +800,7 @@ PathGroups::makeGroupPathEnds(ExceptionTo *to, else { // Only visit -to filter pins. VertexSet endpoints(graph_); - PinSet pins(network); - to->allPins(network, &pins); + PinSet pins = to->allPins(network); PinSet::Iterator pin_iter(pins); while (pin_iter.hasNext()) { const Pin *pin = pin_iter.next(); diff --git a/search/Search.cc b/search/Search.cc index b8307a94..27135bb9 100644 --- a/search/Search.cc +++ b/search/Search.cc @@ -651,8 +651,7 @@ Search::seedFilterStarts() { ExceptionPt *first_pt = filter_->firstPt(); if (first_pt) { - PinSet first_pins(network_); - first_pt->allPins(network_, &first_pins); + PinSet first_pins = first_pt->allPins(network_); for (const Pin *pin : first_pins) { if (network_->isHierarchical(pin)) { SeedFaninsThruHierPin visitor(graph_, this);