summaryrefslogtreecommitdiff
path: root/gcc/global.c
diff options
context:
space:
mode:
authorrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1992-01-20 18:46:58 +0000
committerrms <rms@138bc75d-0d04-0410-961f-82ee72b054a4>1992-01-20 18:46:58 +0000
commit9ebcdd592c7feb8024543e2e0fcf5dcadd1956ef (patch)
tree17ce2df734d4d21ff9a135a09e95a3b3a029fe1c /gcc/global.c
parentc02fbc47f9ba4929798a06609b657f718bbf7391 (diff)
downloadgcc-9ebcdd592c7feb8024543e2e0fcf5dcadd1956ef.tar.gz
*** empty log message ***
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/global.c')
-rw-r--r--gcc/global.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/gcc/global.c b/gcc/global.c
index 25df390eec1..b644624d9bb 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -308,15 +308,33 @@ global_alloc (file)
/* Track which registers have already been used. Start with registers
explicitly in the rtl, then registers allocated by local register
- allocation.
-
- We consider registers that do not have to be saved over calls as if
- they were already used since there is no cost in using them. */
+ allocation. */
CLEAR_HARD_REG_SET (regs_used_so_far);
+#ifdef LEAF_REGISTERS
+ /* If we are doing the leaf function optimization, and this is a leaf
+ function, it means that the registers that take work to save are those
+ that need a register window. So prefer the ones that can be used in
+ a leaf function. */
+ {
+ char *cheap_regs;
+ static char leaf_regs[] = LEAF_REGISTERS;
+
+ if (only_leaf_regs_used () && leaf_function_p ())
+ cheap_regs = leaf_regs;
+ else
+ cheap_regs = call_used_regs;
+ for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
+ if (regs_ever_live[i] || cheap_regs[i])
+ SET_HARD_REG_BIT (regs_used_so_far, i);
+ }
+#else
+ /* We consider registers that do not have to be saved over calls as if
+ they were already used since there is no cost in using them. */
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (regs_ever_live[i] || call_used_regs[i])
SET_HARD_REG_BIT (regs_used_so_far, i);
+#endif
for (i = FIRST_PSEUDO_REGISTER; i < max_regno; i++)
if (reg_renumber[i] >= 0)