This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[ira] Don't calculate memory move costs for NO_REGS
- From: Richard Sandiford <rsandifo at nildram dot co dot uk>
- To: gcc-patches at gcc dot gnu dot org
- Cc: vmakarov at redhat dot com
- Date: Fri, 09 May 2008 18:25:32 +0100
- Subject: [ira] Don't calculate memory move costs for NO_REGS
The IRA setup routines currently try to work out the cost of moving
NO_REGS to and from memory. This in turn depends on the cost of a
secondary reload into or out of NO_REGS. Neither quantity really makes
sense, and MIPS for one assumes that the class passed to the secondary
reload hook is not empty.
Although I could make the MIPS port return NO_REGS when given NO_REGS
(or do the same in default_secondary_reload), I think the best fix is
simply to skip NO_REGS during the cost calculation.
Tested on the WIP MIPS port of IRA, where it fixes a setup failure
in every test. OK to install?
Richard
gcc/
* ira.c (setup_class_subset_and_memory_move_costs): Don't calculate
memory move costs for NO_REGS.
Index: gcc/ira.c
===================================================================
--- gcc/ira.c 2008-05-09 18:17:33.000000000 +0100
+++ gcc/ira.c 2008-05-09 18:19:29.000000000 +0100
@@ -542,11 +542,12 @@ setup_class_subset_and_memory_move_costs
for (cl = (int) N_REG_CLASSES - 1; cl >= 0; cl--)
{
- for (mode = 0; mode < MAX_MACHINE_MODE; mode++)
- {
- memory_move_cost[mode][cl][0] = MEMORY_MOVE_COST (mode, cl, 0);
- memory_move_cost[mode][cl][1] = MEMORY_MOVE_COST (mode, cl, 1);
- }
+ if (cl != (int) NO_REGS)
+ for (mode = 0; mode < MAX_MACHINE_MODE; mode++)
+ {
+ memory_move_cost[mode][cl][0] = MEMORY_MOVE_COST (mode, cl, 0);
+ memory_move_cost[mode][cl][1] = MEMORY_MOVE_COST (mode, cl, 1);
+ }
for (cl2 = (int) N_REG_CLASSES - 1; cl2 >= 0; cl2--)
{