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); diff --git a/tcl/StaTcl.i b/tcl/StaTcl.i index d427f067..1415b96a 100644 --- a/tcl/StaTcl.i +++ b/tcl/StaTcl.i @@ -2495,21 +2495,23 @@ filter_ports(const char *property, const char *pattern, PortSeq *ports) { - Sta *sta = Sta::sta(); PortSeq filtered_ports; - bool exact_match = stringEq(op, "=="); - bool pattern_match = stringEq(op, "=~"); - bool not_match = stringEq(op, "!="); - for (const Port *port : *ports) { - PropertyValue value(getProperty(port, property, sta)); - const char *prop = value.stringValue(); - if (prop && - ((exact_match && stringEq(prop, pattern)) - || (not_match && !stringEq(prop, pattern)) - || (pattern_match && patternMatch(pattern, prop)))) - filtered_ports.push_back(port); + if (ports) { + Sta *sta = Sta::sta(); + bool exact_match = stringEq(op, "=="); + bool pattern_match = stringEq(op, "=~"); + bool not_match = stringEq(op, "!="); + for (const Port *port : *ports) { + PropertyValue value(getProperty(port, property, sta)); + const char *prop = value.stringValue(); + if (prop && + ((exact_match && stringEq(prop, pattern)) + || (not_match && !stringEq(prop, pattern)) + || (pattern_match && patternMatch(pattern, prop)))) + filtered_ports.push_back(port); + } + delete ports; } - delete ports; return filtered_ports; } @@ -2519,22 +2521,24 @@ filter_insts(const char *property, const char *pattern, InstanceSeq *insts) { - Sta *sta = Sta::sta(); - cmdLinkedNetwork(); - bool exact_match = stringEq(op, "=="); - bool pattern_match = stringEq(op, "=~"); - bool not_match = stringEq(op, "!="); InstanceSeq filtered_insts; - for (const Instance *inst : *insts) { - PropertyValue value(getProperty(inst, property, sta)); - const char *prop = value.stringValue(); - if (prop && - ((exact_match && stringEq(prop, pattern)) - || (not_match && !stringEq(prop, pattern)) - || (pattern_match && patternMatch(pattern, prop)))) - filtered_insts.push_back(inst); + if (insts) { + Sta *sta = Sta::sta(); + cmdLinkedNetwork(); + bool exact_match = stringEq(op, "=="); + bool pattern_match = stringEq(op, "=~"); + bool not_match = stringEq(op, "!="); + for (const Instance *inst : *insts) { + PropertyValue value(getProperty(inst, property, sta)); + const char *prop = value.stringValue(); + if (prop && + ((exact_match && stringEq(prop, pattern)) + || (not_match && !stringEq(prop, pattern)) + || (pattern_match && patternMatch(pattern, prop)))) + filtered_insts.push_back(inst); + } + delete insts; } - delete insts; return filtered_insts; } @@ -2544,21 +2548,23 @@ filter_pins(const char *property, const char *pattern, PinSeq *pins) { - Sta *sta = Sta::sta(); PinSeq filtered_pins; - bool exact_match = stringEq(op, "=="); - bool pattern_match = stringEq(op, "=~"); - bool not_match = stringEq(op, "!="); - for (const Pin *pin : *pins) { - PropertyValue value(getProperty(pin, property, sta)); - const char *prop = value.stringValue(); - if (prop && - ((exact_match && stringEq(prop, pattern)) - || (not_match && !stringEq(prop, pattern)) - || (pattern_match && patternMatch(pattern, prop)))) - filtered_pins.push_back(pin); + if (pins) { + Sta *sta = Sta::sta(); + bool exact_match = stringEq(op, "=="); + bool pattern_match = stringEq(op, "=~"); + bool not_match = stringEq(op, "!="); + for (const Pin *pin : *pins) { + PropertyValue value(getProperty(pin, property, sta)); + const char *prop = value.stringValue(); + if (prop && + ((exact_match && stringEq(prop, pattern)) + || (not_match && !stringEq(prop, pattern)) + || (pattern_match && patternMatch(pattern, prop)))) + filtered_pins.push_back(pin); + } + delete pins; } - delete pins; return filtered_pins; }