aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-06-27 15:03:21 -0700
committerEddie Hung <eddie@fpgeh.com>2019-06-27 15:03:21 -0700
commitfb30fcb7c582406f627ebb15833791411091f738 (patch)
treed6e39976afa5f91de7a6888af6d4c4bf777397d7
parent440f173aef421f30c6ce63822532dbb8a1b231af (diff)
downloadyosys-fb30fcb7c582406f627ebb15833791411091f738.tar.gz
yosys-fb30fcb7c582406f627ebb15833791411091f738.tar.bz2
yosys-fb30fcb7c582406f627ebb15833791411091f738.zip
Undo iterator based Module::remove() for cells, as containers will not
invalidate
-rw-r--r--kernel/rtlil.cc12
-rw-r--r--kernel/rtlil.h1
2 files changed, 2 insertions, 11 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index 502b45cfd..a09f4a0d1 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -1592,21 +1592,13 @@ void RTLIL::Module::remove(const pool<RTLIL::Wire*> &wires)
void RTLIL::Module::remove(RTLIL::Cell *cell)
{
- auto it = cells_.find(cell->name);
- log_assert(it != cells_.end());
- remove(it);
-}
-
-dict<RTLIL::IdString, RTLIL::Cell*>::iterator RTLIL::Module::remove(dict<RTLIL::IdString, RTLIL::Cell*>::iterator it)
-{
- RTLIL::Cell *cell = it->second;
while (!cell->connections_.empty())
cell->unsetPort(cell->connections_.begin()->first);
+ log_assert(cells_.count(cell->name) != 0);
log_assert(refcount_cells_ == 0);
- it = cells_.erase(it);
+ cells_.erase(cell->name);
delete cell;
- return it;
}
void RTLIL::Module::rename(RTLIL::Wire *wire, RTLIL::IdString new_name)
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index 4a0f8b4f8..f4fcf5dcf 100644
--- a/kernel/rtlil.h
+++ b/kernel/rtlil.h
@@ -1040,7 +1040,6 @@ public:
// Removing wires is expensive. If you have to remove wires, remove them all at once.
void remove(const pool<RTLIL::Wire*> &wires);
void remove(RTLIL::Cell *cell);
- dict<RTLIL::IdString, RTLIL::Cell*>::iterator remove(dict<RTLIL::IdString, RTLIL::Cell*>::iterator it);
void rename(RTLIL::Wire *wire, RTLIL::IdString new_name);
void rename(RTLIL::Cell *cell, RTLIL::IdString new_name);