ExpandedExceptionVisitor

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2025-09-07 15:22:06 -07:00
parent 26be60906c
commit dcbaaf4c05
3 changed files with 37 additions and 37 deletions

View File

@ -632,7 +632,7 @@ private:
void expandFrom(); void expandFrom();
void expandThrus(ExceptionFrom *expanded_from); void expandThrus(ExceptionFrom *expanded_from);
void expandThru(ExceptionFrom *expanded_from, void expandThru(ExceptionFrom *expanded_from,
ExceptionThruSeq::Iterator &thru_iter, size_t next_thru_idx,
ExceptionThruSeq *expanded_thrus); ExceptionThruSeq *expanded_thrus);
void expandTo(ExceptionFrom *expanded_from, void expandTo(ExceptionFrom *expanded_from,
ExceptionThruSeq *expanded_thrus); ExceptionThruSeq *expanded_thrus);

View File

@ -2146,9 +2146,8 @@ ExpandedExceptionVisitor::expandThrus(ExceptionFrom *expanded_from)
ExceptionThruSeq *thrus = exception_->thrus(); ExceptionThruSeq *thrus = exception_->thrus();
if (thrus) { if (thrus) {
// Use tail recursion to expand the exception points in the thrus. // Use tail recursion to expand the exception points in the thrus.
ExceptionThruSeq::Iterator thru_iter(thrus);
ExceptionThruSeq expanded_thrus; ExceptionThruSeq expanded_thrus;
expandThru(expanded_from, thru_iter, &expanded_thrus); expandThru(expanded_from, 0, &expanded_thrus);
} }
else else
expandTo(expanded_from, nullptr); expandTo(expanded_from, nullptr);
@ -2156,42 +2155,41 @@ ExpandedExceptionVisitor::expandThrus(ExceptionFrom *expanded_from)
void void
ExpandedExceptionVisitor::expandThru(ExceptionFrom *expanded_from, ExpandedExceptionVisitor::expandThru(ExceptionFrom *expanded_from,
ExceptionThruSeq::Iterator &thru_iter, size_t next_thru_idx,
ExceptionThruSeq *expanded_thrus) ExceptionThruSeq *expanded_thrus)
{ {
if (exception_->thrus()) { ExceptionThruSeq *thrus = exception_->thrus();
if (thru_iter.hasNext()) { if (next_thru_idx < thrus->size()) {
ExceptionThru *thru = thru_iter.next(); ExceptionThru *thru = (*thrus)[next_thru_idx];
const RiseFallBoth *rf = thru->transition(); const RiseFallBoth *rf = thru->transition();
if (thru->pins()) { if (thru->pins()) {
for (const Pin *pin : *thru->pins()) { for (const Pin *pin : *thru->pins()) {
PinSet pins(network_); PinSet pins(network_);
pins.insert(pin); pins.insert(pin);
ExceptionThru expanded_thru(&pins, nullptr, nullptr, rf, false, network_); ExceptionThru expanded_thru(&pins, nullptr, nullptr, rf, false, network_);
expanded_thrus->push_back(&expanded_thru); expanded_thrus->push_back(&expanded_thru);
expandThru(expanded_from, thru_iter, expanded_thrus); expandThru(expanded_from, next_thru_idx + 1, expanded_thrus);
expanded_thrus->pop_back(); expanded_thrus->pop_back();
}
} }
if (thru->nets()) { }
for (const Net *net : *thru->nets()) { if (thru->nets()) {
NetSet nets(network_); for (const Net *net : *thru->nets()) {
nets.insert(net); NetSet nets(network_);
ExceptionThru expanded_thru(nullptr, &nets, nullptr, rf, false, network_); nets.insert(net);
expanded_thrus->push_back(&expanded_thru); ExceptionThru expanded_thru(nullptr, &nets, nullptr, rf, false, network_);
expandThru(expanded_from, thru_iter, expanded_thrus); expanded_thrus->push_back(&expanded_thru);
expanded_thrus->pop_back(); expandThru(expanded_from, next_thru_idx + 1, expanded_thrus);
} expanded_thrus->pop_back();
} }
if (thru->instances()) { }
for (const Instance *inst : *thru->instances()) { if (thru->instances()) {
InstanceSet insts(network_); for (const Instance *inst : *thru->instances()) {
insts.insert(inst); InstanceSet insts(network_);
ExceptionThru expanded_thru(nullptr, nullptr, &insts, rf, false, network_); insts.insert(inst);
expanded_thrus->push_back(&expanded_thru); ExceptionThru expanded_thru(nullptr, nullptr, &insts, rf, false, network_);
expandThru(expanded_from, thru_iter, expanded_thrus); expanded_thrus->push_back(&expanded_thru);
expanded_thrus->pop_back(); expandThru(expanded_from, next_thru_idx + 1, expanded_thrus);
} expanded_thrus->pop_back();
} }
} }
} }

View File

@ -5115,8 +5115,10 @@ ExpandException::visit(ExceptionFrom *from,
ExceptionThruSeq *thrus_clone = nullptr; ExceptionThruSeq *thrus_clone = nullptr;
if (thrus) { if (thrus) {
thrus_clone = new ExceptionThruSeq; thrus_clone = new ExceptionThruSeq;
for (ExceptionThru *thru : *thrus) for (ExceptionThru *thru : *thrus) {
thrus_clone->push_back(thru->clone(network_)); ExceptionThru *thru_clone = thru->clone(network_);
thrus_clone->push_back(thru_clone);
}
} }
ExceptionTo *to_clone = nullptr; ExceptionTo *to_clone = nullptr;
if (to) if (to)