mirror of https://github.com/YosysHQ/yosys.git
Undo iterator based Module::remove() for cells, as containers will not
invalidate
This commit is contained in:
parent
440f173aef
commit
fb30fcb7c5
|
@ -1592,21 +1592,13 @@ void RTLIL::Module::remove(const pool<RTLIL::Wire*> &wires)
|
||||||
|
|
||||||
void RTLIL::Module::remove(RTLIL::Cell *cell)
|
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())
|
while (!cell->connections_.empty())
|
||||||
cell->unsetPort(cell->connections_.begin()->first);
|
cell->unsetPort(cell->connections_.begin()->first);
|
||||||
|
|
||||||
|
log_assert(cells_.count(cell->name) != 0);
|
||||||
log_assert(refcount_cells_ == 0);
|
log_assert(refcount_cells_ == 0);
|
||||||
it = cells_.erase(it);
|
cells_.erase(cell->name);
|
||||||
delete cell;
|
delete cell;
|
||||||
return it;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RTLIL::Module::rename(RTLIL::Wire *wire, RTLIL::IdString new_name)
|
void RTLIL::Module::rename(RTLIL::Wire *wire, RTLIL::IdString new_name)
|
||||||
|
|
|
@ -1040,7 +1040,6 @@ public:
|
||||||
// Removing wires is expensive. If you have to remove wires, remove them all at once.
|
// Removing wires is expensive. If you have to remove wires, remove them all at once.
|
||||||
void remove(const pool<RTLIL::Wire*> &wires);
|
void remove(const pool<RTLIL::Wire*> &wires);
|
||||||
void remove(RTLIL::Cell *cell);
|
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::Wire *wire, RTLIL::IdString new_name);
|
||||||
void rename(RTLIL::Cell *cell, RTLIL::IdString new_name);
|
void rename(RTLIL::Cell *cell, RTLIL::IdString new_name);
|
||||||
|
|
Loading…
Reference in New Issue