summaryrefslogtreecommitdiff
path: root/gcc/ira-costs.c
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-27 12:45:13 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-27 12:45:13 +0000
commit268b9e9e95f56a59a8817b28ad59b53f40fc668d (patch)
tree5e9529982daf11d5b3ab800d4c58bc3fbee99d28 /gcc/ira-costs.c
parente1910362719612f58bd1ea5050fa7a5175036abc (diff)
downloadgcc-268b9e9e95f56a59a8817b28ad59b53f40fc668d.tar.gz
2009-04-27 Basile Starynkevitch <basile@starynkevitch.net>
MERGED WITH TRUNK r146824:: * gcc/basilys.h: all GTY goes before the identifiers. * gcc/basilys.c: removed errors.h include. * gcc/run-basilys.h: ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@146839 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ira-costs.c')
-rw-r--r--gcc/ira-costs.c72
1 files changed, 29 insertions, 43 deletions
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 397affd4b1f..513b1fba882 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -1,5 +1,5 @@
/* IRA hard register and memory cost calculation for allocnos.
- Copyright (C) 2006, 2007, 2008
+ Copyright (C) 2006, 2007, 2008, 2009
Free Software Foundation, Inc.
Contributed by Vladimir Makarov <vmakarov@redhat.com>.
@@ -138,9 +138,6 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class rclass, bool to_p,
sri.extra_cost = 0;
secondary_class = targetm.secondary_reload (to_p, x, rclass, mode, &sri);
- if (ira_register_move_cost[mode] == NULL)
- ira_init_register_move_cost (mode);
-
if (secondary_class != NO_REGS)
{
if (!move_cost[mode])
@@ -208,7 +205,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
{
enum reg_class classes[MAX_RECOG_OPERANDS];
int allows_mem[MAX_RECOG_OPERANDS];
- int rclass;
+ enum reg_class rclass;
int alt_fail = 0;
int alt_cost = 0, op_cost_add;
@@ -294,19 +291,17 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
needs to do a copy, which is one insn. */
struct costs *pp = this_op_costs[i];
- if (ira_register_move_cost[mode] == NULL)
- ira_init_register_move_cost (mode);
-
for (k = 0; k < cost_classes_num; k++)
{
rclass = cost_classes[k];
pp->cost[k]
- = ((recog_data.operand_type[i] != OP_OUT
- ? ira_may_move_in_cost[mode][rclass]
- [classes[i]] * frequency : 0)
- + (recog_data.operand_type[i] != OP_IN
- ? ira_may_move_out_cost[mode][classes[i]]
- [rclass] * frequency : 0));
+ = (((recog_data.operand_type[i] != OP_OUT
+ ? ira_get_may_move_cost (mode, rclass,
+ classes[i], true) : 0)
+ + (recog_data.operand_type[i] != OP_IN
+ ? ira_get_may_move_cost (mode, classes[i],
+ rclass, false) : 0))
+ * frequency);
}
/* If the alternative actually allows memory, make
@@ -342,8 +337,9 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
: 0));
else if (ira_reg_class_intersect
[pref_class][classes[i]] == NO_REGS)
- alt_cost += (ira_register_move_cost
- [mode][pref_class][classes[i]]);
+ alt_cost += ira_get_register_move_cost (mode,
+ pref_class,
+ classes[i]);
}
if (REGNO (ops[i]) != REGNO (ops[j])
&& ! find_reg_note (insn, REG_DEAD, op))
@@ -540,19 +536,17 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
{
struct costs *pp = this_op_costs[i];
- if (ira_register_move_cost[mode] == NULL)
- ira_init_register_move_cost (mode);
-
for (k = 0; k < cost_classes_num; k++)
{
rclass = cost_classes[k];
pp->cost[k]
- = ((recog_data.operand_type[i] != OP_OUT
- ? ira_may_move_in_cost[mode][rclass]
- [classes[i]] * frequency : 0)
- + (recog_data.operand_type[i] != OP_IN
- ? ira_may_move_out_cost[mode][classes[i]]
- [rclass] * frequency : 0));
+ = (((recog_data.operand_type[i] != OP_OUT
+ ? ira_get_may_move_cost (mode, rclass,
+ classes[i], true) : 0)
+ + (recog_data.operand_type[i] != OP_IN
+ ? ira_get_may_move_cost (mode, classes[i],
+ rclass, false) : 0))
+ * frequency);
}
/* If the alternative actually allows memory, make
@@ -587,8 +581,9 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
: 0));
else if (ira_reg_class_intersect[pref_class][classes[i]]
== NO_REGS)
- alt_cost += (ira_register_move_cost
- [mode][pref_class][classes[i]]);
+ alt_cost += ira_get_register_move_cost (mode,
+ pref_class,
+ classes[i]);
}
}
}
@@ -677,7 +672,7 @@ record_reg_classes (int n_alts, int n_ops, rtx *ops,
{
unsigned int regno = REGNO (ops[!i]);
enum machine_mode mode = GET_MODE (ops[!i]);
- int rclass;
+ enum reg_class rclass;
unsigned int nr;
if (regno < FIRST_PSEUDO_REGISTER)
@@ -891,7 +886,8 @@ record_address_regs (enum machine_mode mode, rtx x, int context,
case REG:
{
struct costs *pp;
- int i, k;
+ enum reg_class i;
+ int k;
if (REGNO (x) < FIRST_PSEUDO_REGISTER)
break;
@@ -901,13 +897,11 @@ record_address_regs (enum machine_mode mode, rtx x, int context,
ALLOCNO_NUM (ira_curr_regno_allocno_map
[REGNO (x)]));
pp->mem_cost += (ira_memory_move_cost[Pmode][rclass][1] * scale) / 2;
- if (ira_register_move_cost[Pmode] == NULL)
- ira_init_register_move_cost (Pmode);
for (k = 0; k < cost_classes_num; k++)
{
i = cost_classes[k];
pp->cost[k]
- += (ira_may_move_in_cost[Pmode][i][rclass] * scale) / 2;
+ += (ira_get_may_move_cost (Pmode, i, rclass, true) * scale) / 2;
}
}
break;
@@ -1425,8 +1419,9 @@ process_bb_node_for_hard_reg_moves (ira_loop_tree_node_t loop_tree_node)
continue;
mode = ALLOCNO_MODE (a);
hard_reg_class = REGNO_REG_CLASS (hard_regno);
- cost = (to_p ? ira_register_move_cost[mode][hard_reg_class][rclass]
- : ira_register_move_cost[mode][rclass][hard_reg_class]) * freq;
+ cost
+ = (to_p ? ira_get_register_move_cost (mode, hard_reg_class, rclass)
+ : ira_get_register_move_cost (mode, rclass, hard_reg_class)) * freq;
ira_allocate_and_set_costs (&ALLOCNO_HARD_REG_COSTS (a), rclass,
ALLOCNO_COVER_CLASS_COST (a));
ira_allocate_and_set_costs (&ALLOCNO_CONFLICT_HARD_REG_COSTS (a),
@@ -1579,9 +1574,6 @@ ira_finish_costs_once (void)
void
ira_costs (void)
{
- ira_allocno_t a;
- ira_allocno_iterator ai;
-
allocno_costs = (struct costs *) ira_allocate (max_struct_costs_size
* ira_allocnos_num);
total_costs = (struct costs *) ira_allocate (max_struct_costs_size
@@ -1594,12 +1586,6 @@ ira_costs (void)
* max_reg_num ());
find_allocno_class_costs ();
setup_allocno_cover_class_and_costs ();
- /* Because we could process operands only as subregs, check mode of
- the registers themselves too. */
- FOR_EACH_ALLOCNO (a, ai)
- if (ira_register_move_cost[ALLOCNO_MODE (a)] == NULL
- && have_regs_of_mode[ALLOCNO_MODE (a)])
- ira_init_register_move_cost (ALLOCNO_MODE (a));
ira_free (common_classes);
ira_free (allocno_pref_buffer);
ira_free (total_costs);