hard-reg-set.h (losing_caller_save_reg_set): Declare.

* hard-reg-set.h (losing_caller_save_reg_set): Declare.
        * regclass.c (losing_caller_save_reg_set): Define.
        (init_reg_sets_1): Initialize losing_caller_save_reg_set.
        * global.c (find_reg): Avoid caller-saving registers in
        LOSING_CALLER_SAVE_REGS if it's defined.
        * local-alloc.c (find_free_reg): Avoid caller-saving registers
        in losing_caller_save_reg_set.
        (CLASS_LIKELY_SPILLED_P): Delete definition.  Moved into regs.h.
        * regs.h (CLASS_LIKELY_SPILLED_P): Define if not already defined.

From-SVN: r10926
This commit is contained in:
Jeff Law 1995-12-31 19:32:57 -07:00
parent 6e81958a66
commit 6cad67d2d0
5 changed files with 29 additions and 12 deletions

View File

@ -1085,7 +1085,14 @@ find_reg (allocno, losers, alt_regs_p, accept_call_clobbered, retrying)
&& CALLER_SAVE_PROFITABLE (allocno_n_refs[allocno],
allocno_calls_crossed[allocno]))
{
find_reg (allocno, losers, alt_regs_p, 1, retrying);
HARD_REG_SET new_losers;
if (! losers)
CLEAR_HARD_REG_SET (new_losers);
else
COPY_HARD_REG_SET (new_losers, losers);
IOR_HARD_REG_SET(new_losers, losing_caller_save_reg_set);
find_reg (allocno, new_losers, alt_regs_p, 1, retrying);
if (reg_renumber[allocno_reg[allocno]] >= 0)
{
caller_save_needed = 1;

View File

@ -211,6 +211,9 @@ extern char call_used_regs[FIRST_PSEUDO_REGISTER];
extern HARD_REG_SET call_used_reg_set;
/* Registers that we don't want to caller save. */
extern HARD_REG_SET losing_caller_save_reg_set;
/* Indexed by hard register number, contains 1 for registers that are
fixed use -- i.e. in fixed_regs -- or a function value return register
or STRUCT_VALUE_REGNUM or STATIC_CHAIN_REGNUM. These are the

View File

@ -55,6 +55,10 @@ Boston, MA 02111-1307, USA. */
But this is currently disabled since tying in global_alloc is not
yet implemented. */
/* Pseudos allocated here cannot be reallocated by global.c if the hard
register is used as a spill register. So we don't allocate such pseudos
here if their preferred class is likely to be used by spills. */
#include <stdio.h>
#include "config.h"
#include "rtl.h"
@ -66,17 +70,6 @@ Boston, MA 02111-1307, USA. */
#include "recog.h"
#include "output.h"
/* Pseudos allocated here cannot be reallocated by global.c if the hard
register is used as a spill register. So we don't allocate such pseudos
here if their preferred class is likely to be used by spills.
On most machines, the appropriate test is if the class has one
register, so we default to that. */
#ifndef CLASS_LIKELY_SPILLED_P
#define CLASS_LIKELY_SPILLED_P(CLASS) (reg_class_size[(int) (CLASS)] == 1)
#endif
/* Next quantity number available for allocation. */
static int next_qty;
@ -2106,6 +2099,9 @@ find_free_reg (class, mode, qty, accept_call_clobbered, just_try_suggested,
else
COPY_HARD_REG_SET (used, call_used_reg_set);
if (accept_call_clobbered)
IOR_HARD_REG_SET(used, losing_caller_save_reg_set);
for (ins = born_index; ins < dead_index; ins++)
IOR_HARD_REG_SET (used, regs_live_at[ins]);

View File

@ -81,6 +81,9 @@ char call_used_regs[FIRST_PSEUDO_REGISTER];
HARD_REG_SET call_used_reg_set;
/* HARD_REG_SET of registers we want to avoid caller saving. */
HARD_REG_SET losing_caller_save_reg_set;
/* Data for initializing the above. */
static char initial_call_used_regs[] = CALL_USED_REGISTERS;
@ -390,6 +393,8 @@ init_reg_sets_1 ()
SET_HARD_REG_BIT (call_used_reg_set, i);
if (call_fixed_regs[i])
SET_HARD_REG_BIT (call_fixed_reg_set, i);
if (CLASS_LIKELY_SPILLED_P (REGNO_REG_CLASS (i)))
SET_HARD_REG_BIT (losing_caller_save_reg_set, i);
}
}

View File

@ -176,6 +176,12 @@ extern int caller_save_needed;
#define CALLER_SAVE_PROFITABLE(REFS, CALLS) (4 * (CALLS) < (REFS))
#endif
/* On most machines a register class is likely to be spilled if it
only has one register. */
#ifndef CLASS_LIKELY_SPILLED_P
#define CLASS_LIKELY_SPILLED_P(CLASS) (reg_class_size[(int) (CLASS)] == 1)
#endif
/* Allocated in local_alloc. */
/* A list of SCRATCH rtl allocated by local-alloc. */