diff options
author | Richard Kenner <kenner@gcc.gnu.org> | 1996-01-01 18:53:22 -0500 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 1996-01-01 18:53:22 -0500 |
commit | 2c5d9e37fd007519e720cf9ec0a3b72cbe34cb19 (patch) | |
tree | 7d8fbee62445950b7b7269107b0f03d11e242e44 /gcc | |
parent | f7627ef46dd4024a551493e12a6a65ea2b97c16d (diff) | |
download | gcc-2c5d9e37fd007519e720cf9ec0a3b72cbe34cb19.zip gcc-2c5d9e37fd007519e720cf9ec0a3b72cbe34cb19.tar.gz gcc-2c5d9e37fd007519e720cf9ec0a3b72cbe34cb19.tar.bz2 |
(reg_allocno): Declare.
(order_regs_for_reload): New arg, GLOBAL.
Bias against regs allocated in local-alloc.
(reload): Pass new parm to order_regs_for_reload.
From-SVN: r10932
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/reload1.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/gcc/reload1.c b/gcc/reload1.c index 33c77e4..3f5403c 100644 --- a/gcc/reload1.c +++ b/gcc/reload1.c @@ -1,5 +1,5 @@ /* Reload pseudo regs into hard regs for insns that require hard regs. - Copyright (C) 1987, 88, 89, 92, 93, 94, 1995 Free Software Foundation, Inc. + Copyright (C) 1987, 88, 89, 92-5, 1996 Free Software Foundation, Inc. This file is part of GNU CC. @@ -270,6 +270,9 @@ char *reload_firstobj; /* List of labels that must never be deleted. */ extern rtx forced_labels; + +/* Allocation number table from global register allocation. */ +extern int *reg_allocno; /* This structure is used to record information about register eliminations. Each array entry describes one possible way of eliminating a register @@ -351,7 +354,7 @@ static int spill_hard_reg PROTO((int, int, FILE *, int)); static void scan_paradoxical_subregs PROTO((rtx)); static int hard_reg_use_compare PROTO((struct hard_reg_n_uses *, struct hard_reg_n_uses *)); -static void order_regs_for_reload PROTO((void)); +static void order_regs_for_reload PROTO((int)); static int compare_spill_regs PROTO((short *, short *)); static void reload_as_needed PROTO((rtx, int)); static void forget_old_reloads_1 PROTO((rtx, rtx)); @@ -691,7 +694,7 @@ reload (first, global, dumpfile) /* Compute the order of preference for hard registers to spill. Store them by decreasing preference in potential_reload_regs. */ - order_regs_for_reload (); + order_regs_for_reload (global); /* So far, no hard regs have been spilled. */ n_spills = 0; @@ -3494,7 +3497,7 @@ spill_hard_reg (regno, global, dumpfile, cant_eliminate) /* We will need to scan everything again. */ something_changed = 1; if (global) - retry_global_alloc (i, forbidden_regs); + retry_global_alloc (i, forbidden_regs); alter_reg (i, regno); if (dumpfile) @@ -3603,7 +3606,8 @@ hard_reg_use_compare (p1, p2) Store them in order of decreasing preference in potential_reload_regs. */ static void -order_regs_for_reload () +order_regs_for_reload (global) + int global; { register int i; register int o = 0; @@ -3632,7 +3636,15 @@ order_regs_for_reload () { int lim = regno + HARD_REGNO_NREGS (regno, PSEUDO_REGNO_MODE (i)); while (regno < lim) - hard_reg_n_uses[regno++].uses += reg_n_refs[i]; + { + /* If allocated by local-alloc, show more uses since + we're not going to be able to reallocate it, but + we might if allocated by global alloc. */ + if (global && reg_allocno[i] < 0) + hard_reg_n_uses[regno].uses += (reg_n_refs[i] + 1) / 2; + + hard_reg_n_uses[regno++].uses += reg_n_refs[i]; + } } large += reg_n_refs[i]; } |