+2014-09-12 Richard Sandiford <richard.sandiford@arm.com>
+
+ * 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.
+
2014-09-11 Jan Hubicka <hubicka@ucw.cz>
* common.opt (flto-odr-type-merging): New flag.
}
/* Free allocated temporary cost vectors. */
-static void
-free_ira_costs (void)
+void
+target_ira_int::free_ira_costs ()
{
int i;
- free (init_cost);
- init_cost = NULL;
+ free (x_init_cost);
+ x_init_cost = NULL;
for (i = 0; i < MAX_RECOG_OPERANDS; i++)
{
- free (op_costs[i]);
- free (this_op_costs[i]);
- op_costs[i] = this_op_costs[i] = NULL;
+ free (x_op_costs[i]);
+ free (x_this_op_costs[i]);
+ x_op_costs[i] = x_this_op_costs[i] = NULL;
}
- free (temp_costs);
- temp_costs = NULL;
+ free (x_temp_costs);
+ x_temp_costs = NULL;
}
/* This is called each time register related information is
{
int i;
- free_ira_costs ();
+ this_target_ira_int->free_ira_costs ();
max_struct_costs_size
= sizeof (struct costs) + sizeof (int) * (ira_important_classes_num - 1);
/* Don't use ira_allocate because vectors live through several IRA
temp_costs = (struct costs *) xmalloc (max_struct_costs_size);
}
-/* Function called once at the end of compiler work. */
-void
-ira_finish_costs_once (void)
-{
- free_ira_costs ();
-}
-
\f
/* Common initialization function for ira_costs and
minmax_set_iter_next (&(ITER)))
\f
struct target_ira_int {
+ ~target_ira_int ();
+
+ void free_ira_costs ();
+ void free_register_move_costs ();
+
/* Initialized once. It is a maximal possible size of the allocated
struct costs. */
int x_max_struct_costs_size;
/* ira-costs.c */
extern void ira_init_costs_once (void);
extern void ira_init_costs (void);
-extern void ira_finish_costs_once (void);
extern void ira_costs (void);
extern void ira_tune_allocno_costs (void);
/* Free ira_max_register_move_cost, ira_may_move_in_cost and
ira_may_move_out_cost for each mode. */
-static void
-free_register_move_costs (void)
+void
+target_ira_int::free_register_move_costs (void)
{
int mode, i;
/* Reset move_cost and friends, making sure we only free shared
table entries once. */
for (mode = 0; mode < MAX_MACHINE_MODE; mode++)
- if (ira_register_move_cost[mode])
+ if (x_ira_register_move_cost[mode])
{
for (i = 0;
- i < mode && (ira_register_move_cost[i]
- != ira_register_move_cost[mode]);
+ i < mode && (x_ira_register_move_cost[i]
+ != x_ira_register_move_cost[mode]);
i++)
;
if (i == mode)
{
- free (ira_register_move_cost[mode]);
- free (ira_may_move_in_cost[mode]);
- free (ira_may_move_out_cost[mode]);
+ free (x_ira_register_move_cost[mode]);
+ free (x_ira_may_move_in_cost[mode]);
+ free (x_ira_may_move_out_cost[mode]);
}
}
- memset (ira_register_move_cost, 0, sizeof ira_register_move_cost);
- memset (ira_may_move_in_cost, 0, sizeof ira_may_move_in_cost);
- memset (ira_may_move_out_cost, 0, sizeof ira_may_move_out_cost);
+ memset (x_ira_register_move_cost, 0, sizeof x_ira_register_move_cost);
+ memset (x_ira_may_move_in_cost, 0, sizeof x_ira_may_move_in_cost);
+ memset (x_ira_may_move_out_cost, 0, sizeof x_ira_may_move_out_cost);
last_mode_for_init_move_cost = -1;
}
+target_ira_int::~target_ira_int ()
+{
+ free_ira_costs ();
+ free_register_move_costs ();
+}
+
/* This is called every time when register related information is
changed. */
void
ira_init (void)
{
- free_register_move_costs ();
+ this_target_ira_int->free_register_move_costs ();
setup_reg_mode_hard_regset ();
setup_alloc_regs (flag_omit_frame_pointer != 0);
setup_class_subset_and_memory_move_costs ();
ira_init_costs ();
}
-/* Function called once at the end of compiler work. */
-void
-ira_finish_once (void)
-{
- ira_finish_costs_once ();
- free_register_move_costs ();
- lra_finish_once ();
-}
-
\f
#define ira_prohibited_mode_move_regs_initialized_p \
(this_target_ira_int->x_ira_prohibited_mode_move_regs_initialized_p)
extern void ira_init_once (void);
extern void ira_init (void);
-extern void ira_finish_once (void);
extern void ira_setup_eliminable_regset (void);
extern rtx ira_eliminate_regs (rtx, enum machine_mode);
extern void ira_set_pseudo_classes (bool, FILE *);
target_globals::~target_globals ()
{
+ ira_int->~target_ira_int ();
/* default_target_globals points to static data so shouldn't be freed. */
if (this != &default_target_globals)
{
#include "params.h"
#include "reload.h"
#include "ira.h"
+#include "lra.h"
#include "dwarf2asm.h"
#include "debug.h"
#include "target.h"
g->get_passes ()->finish_optimization_passes ();
- ira_finish_once ();
+ lra_finish_once ();
}
if (mem_report)