mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Add Pass::on_register() and Pass::on_shutdown()
Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
		
							parent
							
								
									823a08e0d8
								
							
						
					
					
						commit
						cd92a974f4
					
				
					 3 changed files with 20 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -114,20 +114,35 @@ void Pass::run_register()
 | 
			
		|||
 | 
			
		||||
void Pass::init_register()
 | 
			
		||||
{
 | 
			
		||||
	vector<Pass*> added_passes;
 | 
			
		||||
	while (first_queued_pass) {
 | 
			
		||||
		added_passes.push_back(first_queued_pass);
 | 
			
		||||
		first_queued_pass->run_register();
 | 
			
		||||
		first_queued_pass = first_queued_pass->next_queued_pass;
 | 
			
		||||
	}
 | 
			
		||||
	for (auto added_pass : added_passes)
 | 
			
		||||
		added_pass->on_register();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Pass::done_register()
 | 
			
		||||
{
 | 
			
		||||
	for (auto &it : pass_register)
 | 
			
		||||
		it.second->on_shutdown();
 | 
			
		||||
 | 
			
		||||
	frontend_register.clear();
 | 
			
		||||
	pass_register.clear();
 | 
			
		||||
	backend_register.clear();
 | 
			
		||||
	log_assert(first_queued_pass == NULL);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Pass::on_register()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void Pass::on_shutdown()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
Pass::~Pass()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -62,6 +62,9 @@ struct Pass
 | 
			
		|||
	virtual void run_register();
 | 
			
		||||
	static void init_register();
 | 
			
		||||
	static void done_register();
 | 
			
		||||
 | 
			
		||||
	virtual void on_register();
 | 
			
		||||
	virtual void on_shutdown();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct ScriptPass : Pass
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -544,6 +544,8 @@ void yosys_shutdown()
 | 
			
		|||
	already_shutdown = true;
 | 
			
		||||
	log_pop();
 | 
			
		||||
 | 
			
		||||
	Pass::done_register();
 | 
			
		||||
 | 
			
		||||
	delete yosys_design;
 | 
			
		||||
	yosys_design = NULL;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -553,7 +555,6 @@ void yosys_shutdown()
 | 
			
		|||
	log_errfile = NULL;
 | 
			
		||||
	log_files.clear();
 | 
			
		||||
 | 
			
		||||
	Pass::done_register();
 | 
			
		||||
	yosys_celltypes.clear();
 | 
			
		||||
 | 
			
		||||
#ifdef YOSYS_ENABLE_TCL
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue