mirror of https://github.com/YosysHQ/yosys.git
patch: don't track root cell deletions for perf
This commit is contained in:
parent
e2a77db87a
commit
a689cdc6ed
|
|
@ -88,7 +88,7 @@ struct SrcCollector {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void Patch::gc(Cell* old_cell) {
|
void Patch::gc(Cell* old_cell, bool track) {
|
||||||
log_debug("gc %s\n", old_cell->name);
|
log_debug("gc %s\n", old_cell->name);
|
||||||
if (old_cell->type.in(ID($input_port), ID($output_port), ID($public)))
|
if (old_cell->type.in(ID($input_port), ID($output_port), ID($public)))
|
||||||
return;
|
return;
|
||||||
|
|
@ -119,9 +119,13 @@ void Patch::gc(Cell* old_cell) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log_debug("\tremove %s\n", old_cell->name);
|
log_debug("\tremove %s\n", old_cell->name);
|
||||||
|
// Only track recursively-removed cells. The top-level patched cell is the
|
||||||
|
// caller's current iteration variable and won't be re-encountered.
|
||||||
|
if (track && removed_cells)
|
||||||
|
removed_cells->insert(old_cell);
|
||||||
old_cell->module->remove(old_cell);
|
old_cell->module->remove(old_cell);
|
||||||
for (auto input : inputs)
|
for (auto input : inputs)
|
||||||
gc(input);
|
gc(input, /*track=*/true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Wire* Patch::commit_wire(std::unique_ptr<Wire> wire) {
|
Wire* Patch::commit_wire(std::unique_ptr<Wire> wire) {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ YOSYS_NAMESPACE_BEGIN
|
||||||
struct RTLIL::Patch : public CellAdderMixin<RTLIL::Patch>
|
struct RTLIL::Patch : public CellAdderMixin<RTLIL::Patch>
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
void gc(Cell* old_cell);
|
void gc(Cell* old_cell, bool track = false);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void add(RTLIL::Wire *wire);
|
void add(RTLIL::Wire *wire);
|
||||||
|
|
@ -25,6 +25,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
Module* mod;
|
Module* mod;
|
||||||
SigMap* map;
|
SigMap* map;
|
||||||
|
pool<Cell*>* removed_cells = nullptr;
|
||||||
vector<std::unique_ptr<Wire>> wires_ = {};
|
vector<std::unique_ptr<Wire>> wires_ = {};
|
||||||
vector<std::unique_ptr<Cell>> cells_ = {};
|
vector<std::unique_ptr<Cell>> cells_ = {};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue