RFA: Add a destructor to target_ira_int

Jeff Law law@redhat.com
Thu Sep 11 20:32:00 GMT 2014


On 09/08/14 09:26, Richard Sandiford wrote:
> This patch adds a destructor to target_ira_int, so that the data structures
> it points to are freed when the parent target_globals is freed.  It fixes
> a memory leak with non-default subtargets.
>
> Tested on x86_64-linux-gnu.  OK to install?
>
> Thanks,
> Richard
>
>
> gcc/
> 	* ira.h (ira_finish_once): Delete.
> 	* ira-int.h (target_ira_int::~target_ira_int): Declare.
> 	(target_ira_int::free_ira_costs): Likewise.
> 	(target_ira_int::free_register_move_costs): Likewise.
> 	(ira_finish_costs_once): Delete.
> 	* ira.c (free_register_move_costs): Replace with...
> 	(target_ira_int::free_register_move_costs): ...this new function.
> 	(target_ira_int::~target_ira_int): Define.
> 	(ira_init): Call free_register_move_costs as a member function rather
> 	than a global function.
> 	(ira_finish_once): Delete.
> 	* ira-costs.c (free_ira_costs): Replace with...
> 	(target_ira_int::free_ira_costs): ...this new function.
> 	(ira_init_costs): Call free_ira_costs as a member function rather
> 	than a global function.
> 	(ira_finish_costs_once): Delete.
> 	* target-globals.c (target_globals::~target_globals): Call the
> 	target_ira_int destructor.
> 	* toplev.c: Include lra.h.
> 	(finalize): Call lra_finish_once rather than ira_finish_once.
Consider making target_ira_int a class.  OK for the trunk.

jeff



More information about the Gcc-patches mailing list