mirror of https://github.com/YosysHQ/yosys.git
Merge pull request #1622 from YosysHQ/clifford/onpassreg
Add Pass::on_register() and Pass::on_shutdown()
This commit is contained in:
commit
d2df2a8fef
|
@ -114,20 +114,35 @@ void Pass::run_register()
|
||||||
|
|
||||||
void Pass::init_register()
|
void Pass::init_register()
|
||||||
{
|
{
|
||||||
|
vector<Pass*> added_passes;
|
||||||
while (first_queued_pass) {
|
while (first_queued_pass) {
|
||||||
|
added_passes.push_back(first_queued_pass);
|
||||||
first_queued_pass->run_register();
|
first_queued_pass->run_register();
|
||||||
first_queued_pass = first_queued_pass->next_queued_pass;
|
first_queued_pass = first_queued_pass->next_queued_pass;
|
||||||
}
|
}
|
||||||
|
for (auto added_pass : added_passes)
|
||||||
|
added_pass->on_register();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Pass::done_register()
|
void Pass::done_register()
|
||||||
{
|
{
|
||||||
|
for (auto &it : pass_register)
|
||||||
|
it.second->on_shutdown();
|
||||||
|
|
||||||
frontend_register.clear();
|
frontend_register.clear();
|
||||||
pass_register.clear();
|
pass_register.clear();
|
||||||
backend_register.clear();
|
backend_register.clear();
|
||||||
log_assert(first_queued_pass == NULL);
|
log_assert(first_queued_pass == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pass::on_register()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Pass::on_shutdown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Pass::~Pass()
|
Pass::~Pass()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,9 @@ struct Pass
|
||||||
virtual void run_register();
|
virtual void run_register();
|
||||||
static void init_register();
|
static void init_register();
|
||||||
static void done_register();
|
static void done_register();
|
||||||
|
|
||||||
|
virtual void on_register();
|
||||||
|
virtual void on_shutdown();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ScriptPass : Pass
|
struct ScriptPass : Pass
|
||||||
|
|
|
@ -544,6 +544,8 @@ void yosys_shutdown()
|
||||||
already_shutdown = true;
|
already_shutdown = true;
|
||||||
log_pop();
|
log_pop();
|
||||||
|
|
||||||
|
Pass::done_register();
|
||||||
|
|
||||||
delete yosys_design;
|
delete yosys_design;
|
||||||
yosys_design = NULL;
|
yosys_design = NULL;
|
||||||
|
|
||||||
|
@ -553,7 +555,6 @@ void yosys_shutdown()
|
||||||
log_errfile = NULL;
|
log_errfile = NULL;
|
||||||
log_files.clear();
|
log_files.clear();
|
||||||
|
|
||||||
Pass::done_register();
|
|
||||||
yosys_celltypes.clear();
|
yosys_celltypes.clear();
|
||||||
|
|
||||||
#ifdef YOSYS_ENABLE_TCL
|
#ifdef YOSYS_ENABLE_TCL
|
||||||
|
|
Loading…
Reference in New Issue