summaryrefslogtreecommitdiff
path: root/gcc/ira-costs.c
diff options
context:
space:
mode:
authorAnatoly Sokolov <aesok@post.ru>2010-10-11 21:41:24 +0400
committerAnatoly Sokolov <aesok@gcc.gnu.org>2010-10-11 21:41:24 +0400
commitfba42e243e264f3b4d507d075b38c699821d5951 (patch)
tree4b63d698c47af01f476f8ddd1376746e9309a913 /gcc/ira-costs.c
parent43c36287976d2cb4d134aff2952eca031c78eb59 (diff)
downloadgcc-fba42e243e264f3b4d507d075b38c699821d5951.tar.gz
target.def (preferred_reload_class): New hook.
* target.def (preferred_reload_class): New hook. * doc/tm.texi.in (TARGET_PREFERRED_RELOAD_CLASS): Document. * doc/tm.texi: Regenerate. * targhooks.c (default_preferred_reload_class): New function. * targhooks.h (default_preferred_reload_class): Declare. * reload.c (find_dummy_reload): Change preferred_class variable type from enum reg_class to reg_class_t. Use TARGET_PREFERRED_RELOAD_CLASS target hook. (find_reloads): Change goal_alternative array type from int to reg_class_t. Use TARGET_PREFERRED_RELOAD_CLASS target hook. (push_reload, find_reloads_address_part): Use TARGET_PREFERRED_RELOAD_CLASS target hook. * reload1.c (emit_input_reload_insns): Ditto. * ira-costs.c (copy_cost): Use TARGET_PREFERRED_RELOAD_CLASS target hook. Change rclass argument and secondary_class variable types from 'enum reg_class' to reg_class_t. * config/i386/i386.h (PREFERRED_RELOAD_CLASS): Remove. * config/i386/i386-protos (ix86_preferred_reload_class): Remove. * config/i386/i386.c (ix86_preferred_reload_class): Make static. Change regclass argument and result types from enum reg_class to reg_class_t. (TARGET_PREFERRED_RELOAD_CLASS): Define. From-SVN: r165321
Diffstat (limited to 'gcc/ira-costs.c')
-rw-r--r--gcc/ira-costs.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 24e8393dd0b..3d8298d94a0 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -131,11 +131,11 @@ static int frequency;
TO_P is FALSE) a register of class RCLASS in mode MODE. X must not
be a pseudo register. */
static int
-copy_cost (rtx x, enum machine_mode mode, enum reg_class rclass, bool to_p,
+copy_cost (rtx x, enum machine_mode mode, reg_class_t rclass, bool to_p,
secondary_reload_info *prev_sri)
{
secondary_reload_info sri;
- enum reg_class secondary_class = NO_REGS;
+ reg_class_t secondary_class = NO_REGS;
/* If X is a SCRATCH, there is actually nothing to move since we are
assuming optimal allocation. */
@@ -143,21 +143,21 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class rclass, bool to_p,
return 0;
/* Get the class we will actually use for a reload. */
- rclass = PREFERRED_RELOAD_CLASS (x, rclass);
+ rclass = targetm.preferred_reload_class (x, rclass);
/* If we need a secondary reload for an intermediate, the cost is
that to load the input into the intermediate register, then to
copy it. */
sri.prev_sri = prev_sri;
sri.extra_cost = 0;
- secondary_class
- = (enum reg_class) targetm.secondary_reload (to_p, x, rclass, mode, &sri);
+ secondary_class = targetm.secondary_reload (to_p, x, rclass, mode, &sri);
if (secondary_class != NO_REGS)
{
if (!move_cost[mode])
init_move_cost (mode);
- return (move_cost[mode][secondary_class][rclass] + sri.extra_cost
+ return (move_cost[mode][(int) secondary_class][(int) rclass]
+ + sri.extra_cost
+ copy_cost (x, mode, secondary_class, to_p, &sri));
}
@@ -165,12 +165,14 @@ copy_cost (rtx x, enum machine_mode mode, enum reg_class rclass, bool to_p,
the cost to move between the register classes, and use 2 for
everything else (constants). */
if (MEM_P (x) || rclass == NO_REGS)
- return sri.extra_cost + ira_memory_move_cost[mode][rclass][to_p != 0];
+ return sri.extra_cost
+ + ira_memory_move_cost[mode][(int) rclass][to_p != 0];
else if (REG_P (x))
{
if (!move_cost[mode])
init_move_cost (mode);
- return (sri.extra_cost + move_cost[mode][REGNO_REG_CLASS (REGNO (x))][rclass]);
+ return (sri.extra_cost
+ + move_cost[mode][REGNO_REG_CLASS (REGNO (x))][(int) rclass]);
}
else
/* If this is a constant, we may eventually want to call rtx_cost