Commit aa1c5d72 by Richard Sandiford Committed by Richard Sandiford

ira-int.h (target_ira_int): Add x_max_struct_costs_size...

gcc/
	* ira-int.h (target_ira_int): Add x_max_struct_costs_size, x_init_cost,
	x_temp_costs, x_op_costs, x_this_op_costs and x_cost_classes.
	* ira-costs.c (max_struct_costs_size, init_cost, temp_costs, op_costs)
	(this_op_costs, costs_classes): Redefine as macros.
	(record_reg_classes): Don't take op_costs as a parameter.
	(record_operand_costs): Likewise.  Update calls to record_reg_classes.
	(scan_one_insn): Update call to record_operand_costs.

From-SVN: r162103
parent afcc66c4
2010-07-12 Richard Sandiford <rdsandiford@googlemail.com> 2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
* ira-int.h (target_ira_int): Add x_max_struct_costs_size, x_init_cost,
x_temp_costs, x_op_costs, x_this_op_costs and x_cost_classes.
* ira-costs.c (max_struct_costs_size, init_cost, temp_costs, op_costs)
(this_op_costs, costs_classes): Redefine as macros.
(record_reg_classes): Don't take op_costs as a parameter.
(record_operand_costs): Likewise. Update calls to record_reg_classes.
(scan_one_insn): Update call to record_operand_costs.
2010-07-12 Richard Sandiford <rdsandiford@googlemail.com>
* Makefile.in (target-globals.o): Depend on $(IRA_INT_H). * Makefile.in (target-globals.o): Depend on $(IRA_INT_H).
* ira-int.h (ira_max_nregs, ira_important_class_nums): Delete. * ira-int.h (ira_max_nregs, ira_important_class_nums): Delete.
(target_ira_int): New structure. (target_ira_int): New structure.
......
...@@ -68,20 +68,18 @@ struct costs ...@@ -68,20 +68,18 @@ struct costs
int cost[1]; int cost[1];
}; };
/* Initialized once. It is a maximal possible size of the allocated #define max_struct_costs_size \
struct costs. */ (this_target_ira_int->x_max_struct_costs_size)
static int max_struct_costs_size; #define init_cost \
(this_target_ira_int->x_init_cost)
/* Allocated and initialized once, and used to initialize cost values #define temp_costs \
for each insn. */ (this_target_ira_int->x_temp_costs)
static struct costs *init_cost; #define op_costs \
(this_target_ira_int->x_op_costs)
/* Allocated once, and used for temporary purposes. */ #define this_op_costs \
static struct costs *temp_costs; (this_target_ira_int->x_this_op_costs)
#define cost_classes \
/* Allocated once, and used for the cost calculation. */ (this_target_ira_int->x_cost_classes)
static struct costs *op_costs[MAX_RECOG_OPERANDS];
static struct costs *this_op_costs[MAX_RECOG_OPERANDS];
/* Costs of each class for each allocno or pseudo. */ /* Costs of each class for each allocno or pseudo. */
static struct costs *costs; static struct costs *costs;
...@@ -89,11 +87,6 @@ static struct costs *costs; ...@@ -89,11 +87,6 @@ static struct costs *costs;
/* Accumulated costs of each class for each allocno. */ /* Accumulated costs of each class for each allocno. */
static struct costs *total_allocno_costs; static struct costs *total_allocno_costs;
/* Classes used for cost calculation. They may be different on
different iterations of the cost calculations or in different
optimization modes. */
static enum reg_class *cost_classes;
/* The size of the previous array. */ /* The size of the previous array. */
static int cost_classes_num; static int cost_classes_num;
...@@ -210,8 +203,7 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class rclass, bool to_p, ...@@ -210,8 +203,7 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class rclass, bool to_p,
static void static void
record_reg_classes (int n_alts, int n_ops, rtx *ops, record_reg_classes (int n_alts, int n_ops, rtx *ops,
enum machine_mode *modes, const char **constraints, enum machine_mode *modes, const char **constraints,
rtx insn, struct costs **op_costs, rtx insn, enum reg_class *pref)
enum reg_class *pref)
{ {
int alt; int alt;
int i, j, k; int i, j, k;
...@@ -945,7 +937,7 @@ record_address_regs (enum machine_mode mode, rtx x, int context, ...@@ -945,7 +937,7 @@ record_address_regs (enum machine_mode mode, rtx x, int context,
/* Calculate the costs of insn operands. */ /* Calculate the costs of insn operands. */
static void static void
record_operand_costs (rtx insn, struct costs **op_costs, enum reg_class *pref) record_operand_costs (rtx insn, enum reg_class *pref)
{ {
const char *constraints[MAX_RECOG_OPERANDS]; const char *constraints[MAX_RECOG_OPERANDS];
enum machine_mode modes[MAX_RECOG_OPERANDS]; enum machine_mode modes[MAX_RECOG_OPERANDS];
...@@ -998,11 +990,11 @@ record_operand_costs (rtx insn, struct costs **op_costs, enum reg_class *pref) ...@@ -998,11 +990,11 @@ record_operand_costs (rtx insn, struct costs **op_costs, enum reg_class *pref)
xconstraints[i+1] = constraints[i]; xconstraints[i+1] = constraints[i];
record_reg_classes (recog_data.n_alternatives, recog_data.n_operands, record_reg_classes (recog_data.n_alternatives, recog_data.n_operands,
recog_data.operand, modes, recog_data.operand, modes,
xconstraints, insn, op_costs, pref); xconstraints, insn, pref);
} }
record_reg_classes (recog_data.n_alternatives, recog_data.n_operands, record_reg_classes (recog_data.n_alternatives, recog_data.n_operands,
recog_data.operand, modes, recog_data.operand, modes,
constraints, insn, op_costs, pref); constraints, insn, pref);
} }
...@@ -1047,7 +1039,7 @@ scan_one_insn (rtx insn) ...@@ -1047,7 +1039,7 @@ scan_one_insn (rtx insn)
0, MEM, SCRATCH, frequency * 2); 0, MEM, SCRATCH, frequency * 2);
} }
record_operand_costs (insn, op_costs, pref); record_operand_costs (insn, pref);
/* Now add the cost for each operand to the total costs for its /* Now add the cost for each operand to the total costs for its
allocno. */ allocno. */
......
...@@ -715,6 +715,26 @@ minmax_set_iter_next (minmax_set_iterator *i) ...@@ -715,6 +715,26 @@ minmax_set_iter_next (minmax_set_iterator *i)
minmax_set_iter_next (&(ITER))) minmax_set_iter_next (&(ITER)))
struct target_ira_int { struct target_ira_int {
/* Initialized once. It is a maximal possible size of the allocated
struct costs. */
int x_max_struct_costs_size;
/* Allocated and initialized once, and used to initialize cost values
for each insn. */
struct costs *x_init_cost;
/* Allocated once, and used for temporary purposes. */
struct costs *x_temp_costs;
/* Allocated once, and used for the cost calculation. */
struct costs *x_op_costs[MAX_RECOG_OPERANDS];
struct costs *x_this_op_costs[MAX_RECOG_OPERANDS];
/* Classes used for cost calculation. They may be different on
different iterations of the cost calculations or in different
optimization modes. */
enum reg_class *x_cost_classes;
/* Hard registers that can not be used for the register allocator for /* Hard registers that can not be used for the register allocator for
all functions of the current compilation unit. */ all functions of the current compilation unit. */
HARD_REG_SET x_no_unit_alloc_regs; HARD_REG_SET x_no_unit_alloc_regs;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment