aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/sh
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-09-10 18:57:09 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-09-10 18:57:09 +0000
commitd7fb4c3162307590c0babddcea4fb60c07a7c033 (patch)
treeb7a8cc40362f33043a160a1591ff79c0941f447a /gcc/config/sh
parent53bee79caba4fb88acbcd9bad7891ea45b5511e3 (diff)
downloadgcc-d7fb4c3162307590c0babddcea4fb60c07a7c033.zip
gcc-d7fb4c3162307590c0babddcea4fb60c07a7c033.tar.gz
gcc-d7fb4c3162307590c0babddcea4fb60c07a7c033.tar.bz2
Remove call_really_used_regs
After previous patches, it's now possible for call_used_regs to be the "real" set of call-clobbered registers, without any special handling for fixed registers. This patch therefore removes the separate call_really_used_regs and updates the targets that define CALL_REALLY_USED_REGISTERS so that they handle call_used_regs in the same way that they used to handle call_really_used_regs. With this change, it's no longer necessary for targets that define CALL_REALLY_USED_REGISTERS to define CALL_USED_REGISTER as well. 2019-09-10 Richard Sandiford <richard.sandiford@arm.com> gcc/ * doc/tm.texi.in: Document that exactly one of CALL_USED_REGISTERS and CALL_REALLY_USED_REGISTERS must be defined, and that CALL_REALLY_USED_REGISTERS is preferred. * doc/tm.texi: Regenerate. * hard-reg-set.h (target_hard_regs::x_call_really_used_regs): Delete. (call_really_used_regs): Likewise. * reginfo.c: Raise an #error if both CALL_USED_REGISTERS and CALL_REALLY_USED_REGISTERS are defined. (initial_call_used_regs): Use CALL_REALLY_USED_REGISTERS as the initial value if defined. (initial_call_really_used_regs): Delete. (saved_call_really_used_regs): Likewise. (CALL_REALLY_USED_REGNO_P): Likewise. (init_reg_sets): Remove handling of call_really_used_regs. (save_register_info, restore_register_info, globalize_reg): Likewise. (init_reg_sets_1): Likewise. Use call_used_regs instead of CALL_REALLY_USED_REGNO_P. Don't set call_used_regs for registers outside operand_reg_set. (fix_register): Don't change call_used_regs if CALL_REALLY_USED_REGISTERS is defined. * config/csky/csky.h (CALL_USED_REGISTERS): Delete. * config/csky/csky.c (get_csky_live_regs): Use call_used_regs instead of call_really_used_regs. (csky_conditional_register_usage): Remove the old handling of call_used_regs and change the handling of call_really_used_regs to use call_used_regs instead. * config/ia64/ia64.h (CALL_USED_REGISTERS): Delete. * config/ia64/ia64.c (fix_range): Don't set call_used_regs when making a register fixed. * config/m32r/m32r.h (CALL_USED_REGISTERS): Delete. * config/m32r/m32r.c (MUST_SAVE_REGISTER): Use call_used_regs instead of call_really_used_regs. (m32r_conditional_register_usage): Don't set call_used_regs when making a register fixed. * config/mips/mips.h (CALL_USED_REGISTERS): Delete. * config/mips/mips.c (mips_global_pointer): Use call_used_regs instead of call_really_used_regs. (mips_interrupt_extra_call_saved_reg_p): Likewise. (mips_cfun_call_saved_reg_p): Likewise. (mips_swap_registers): Remove the old handling of call_used_regs and change the handling of call_really_used_regs to use call_used_regs instead. (mips_conditional_register_usage): Likewise. * config/mn10300/mn10300.h (CALL_USED_REGISTERS): Delete. * config/mn10300/mn10300.c (fp_regs_to_save): Use call_used_regs instead of call_really_used_regs. (mn10300_get_live_callee_saved_regs): Likewise. (mn10300_expand_prologue, mn10300_expand_epilogue): Likewise. (mn10300_conditional_register_usage): Don't set call_used_regs when making a register fixed. * config/rs6000/rs6000.h (CALL_USED_REGISTERS): Delete. * config/rs6000/rs6000.c (rs6000_conditional_register_usage): Remove the old handling of call_used_regs and change the handling of call_really_used_regs to use call_used_regs instead. * config/s390/s390.h (CALL_USED_REGISTERS): Delete. * config/s390/s390.c (s390_regs_ever_clobbered): Use call_used_regs instead of call_really_used_regs. (s390_register_info_gprtofpr, s390_register_info): Likewise. (s390_hard_regno_rename_ok, s390_hard_regno_scratch_ok): Likewise. (s390_emit_prologue, s300_set_up_by_prologue): Likewise. (s390_can_use_return_insn, s390_optimize_prologue): Likewise. (s390_conditional_register_usage): Remove the old handling of call_used_regs and change the handling of call_really_used_regs to use call_used_regs instead. * config/sh/sh.h (CALL_USED_REGISTERS): Delete. * config/sh/sh.c (output_stack_adjust, calc_live_regs): Likewise. (sh_fix_range, reg_unused_after): Likewise. (sh_conditional_register_usage): Remove the old handling of call_used_regs and change the handling of call_really_used_regs to use call_used_regs instead. * config/sparc/sparc.h (CALL_USED_REGISTERS): Delete. * config/sparc/sparc.c (sparc_conditional_register_usage): Don't set call_used_regs when making a register fixed. * config/tilegx/tilegx.h (CALL_USED_REGISTERS): Delete. * config/tilegx/tilegx.c (tilegx_conditional_register_usage): Don't set call_used_regs when making a register fixed. * config/tilepro/tilepro.h (CALL_USED_REGISTERS): Delete. * config/tilepro/tilepro.c (tilepro_conditional_register_usage): Don't set call_used_regs when making a register fixed. * config/visium/visium.h (CALL_USED_REGISTERS): Delete. * config/visium/visium.c (visium_conditional_register_usage): Remove the old handling of call_used_regs and change the handling of call_really_used_regs to use call_used_regs instead. From-SVN: r275605
Diffstat (limited to 'gcc/config/sh')
-rw-r--r--gcc/config/sh/sh.c30
-rw-r--r--gcc/config/sh/sh.h39
2 files changed, 13 insertions, 56 deletions
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index ef60b8c..e3eea10 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -6703,7 +6703,7 @@ output_stack_adjust (int size, rtx reg, int epilogue_p,
to handle this case, so just die when we see it. */
if (epilogue_p < 0
|| current_function_interrupt
- || ! call_really_used_regs[temp] || fixed_regs[temp])
+ || ! call_used_regs[temp] || fixed_regs[temp])
temp = -1;
if (temp < 0 && ! current_function_interrupt && epilogue_p >= 0)
{
@@ -7009,7 +7009,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask)
else if (TARGET_FPU_DOUBLE && TARGET_FMOVD && TARGET_FPU_SINGLE)
for (int count = 0, reg = FIRST_FP_REG; reg <= LAST_FP_REG; reg += 2)
if (df_regs_ever_live_p (reg) && df_regs_ever_live_p (reg+1)
- && (! call_really_used_regs[reg]
+ && (! call_used_regs[reg]
|| interrupt_handler)
&& ++count > 2)
{
@@ -7040,7 +7040,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask)
: interrupt_handler
? (/* Need to save all the regs ever live. */
(df_regs_ever_live_p (reg)
- || (call_really_used_regs[reg]
+ || (call_used_regs[reg]
&& (! fixed_regs[reg] || reg == MACH_REG || reg == MACL_REG
|| reg == PIC_OFFSET_TABLE_REGNUM)
&& has_call))
@@ -7053,7 +7053,7 @@ calc_live_regs (HARD_REG_SET *live_regs_mask)
: (/* Only push those regs which are used and need to be saved. */
(false)
|| (df_regs_ever_live_p (reg)
- && ((!call_really_used_regs[reg]
+ && ((!call_used_regs[reg]
&& !(reg != PIC_OFFSET_TABLE_REGNUM
&& fixed_regs[reg]
&& call_used_or_fixed_reg_p (reg)))
@@ -8289,7 +8289,7 @@ sh_fix_range (const char *const_str)
}
for (int i = first; i <= last; ++i)
- fixed_regs[i] = call_used_regs[i] = 1;
+ fixed_regs[i] = 1;
if (!comma)
break;
@@ -8809,7 +8809,7 @@ reg_unused_after (rtx reg, rtx_insn *insn)
if (set == NULL && reg_overlap_mentioned_p (reg, PATTERN (insn)))
return false;
- if (code == CALL_INSN && call_really_used_regs[REGNO (reg)])
+ if (code == CALL_INSN && call_used_regs[REGNO (reg)])
return true;
}
return true;
@@ -11447,32 +11447,28 @@ sh_conditional_register_usage (void)
{
for (int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno ++)
if (! VALID_REGISTER_P (regno))
- fixed_regs[regno] = call_used_regs[regno] = 1;
+ fixed_regs[regno] = 1;
/* R8 and R9 are call-clobbered on SH5, but not on earlier SH ABIs. */
if (flag_pic)
- {
- fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;
- call_used_regs[PIC_OFFSET_TABLE_REGNUM] = 1;
- }
+ fixed_regs[PIC_OFFSET_TABLE_REGNUM] = 1;
if (TARGET_FDPIC)
{
fixed_regs[PIC_REG] = 1;
call_used_regs[PIC_REG] = 1;
- call_really_used_regs[PIC_REG] = 1;
}
/* Renesas saves and restores mac registers on call. */
if (TARGET_HITACHI && ! TARGET_NOMACSAVE)
{
- call_really_used_regs[MACH_REG] = 0;
- call_really_used_regs[MACL_REG] = 0;
+ call_used_regs[MACH_REG] = 0;
+ call_used_regs[MACL_REG] = 0;
}
for (int regno = FIRST_GENERAL_REG; regno <= LAST_GENERAL_REG; regno++)
- if (! fixed_regs[regno] && call_really_used_regs[regno])
+ if (! fixed_regs[regno] && call_used_regs[regno])
SET_HARD_REG_BIT (reg_class_contents[SIBCALL_REGS], regno);
- call_really_used_regs[FPSCR_MODES_REG] = 0;
- call_really_used_regs[FPSCR_STAT_REG] = 0;
+ call_used_regs[FPSCR_MODES_REG] = 0;
+ call_used_regs[FPSCR_STAT_REG] = 0;
}
/* Implement TARGET_LEGITIMATE_CONSTANT_P
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index 0204872..3e38488 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -732,45 +732,6 @@ extern char sh_additional_register_names[ADDREGNAMES_SIZE] \
1, 1, 1, 1, \
}
-/* 1 for registers not available across function calls.
- These must include the FIXED_REGISTERS and also any
- registers that can be used without being saved.
- The latter must include the registers where values are returned
- and the register where structure-value addresses are passed.
- Aside from that, you can include as many other registers as you like. */
-#define CALL_USED_REGISTERS \
-{ \
-/* Regular registers. */ \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- /* R8 and R9 are call-clobbered on SH5, but not on earlier SH ABIs. \
- Only the lower 32bits of R10-R14 are guaranteed to be preserved \
- across SH5 function calls. */ \
- 0, 0, 0, 0, 0, 0, 0, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 0, 0, 0, 0, \
- 0, 0, 0, 0, 1, 1, 1, 1, \
- 1, 1, 1, 1, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 1, 1, 1, 1, \
-/* FP registers. */ \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 0, 0, 0, 0, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 1, 1, 1, 1, \
- 1, 1, 1, 1, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
- 0, 0, 0, 0, 0, 0, 0, 0, \
-/* Branch target registers. */ \
- 1, 1, 1, 1, 1, 0, 0, 0, \
-/* XD registers. */ \
- 1, 1, 1, 1, 1, 1, 0, 0, \
-/*"gbr", "ap", "pr", "t", "mach", "macl", "fpul", "fpscr", */ \
- 1, 1, 1, 1, 1, 1, 1, 1, \
-/*"rap", "sfp","fpscr0","fpscr1" */ \
- 1, 1, 1, 1, \
-}
-
/* CALL_REALLY_USED_REGISTERS is used as a default setting, which is then
overridden by -fcall-saved-* and -fcall-used-* options and then by
TARGET_CONDITIONAL_REGISTER_USAGE. There we might want to make a