Commit 12e20dde by Richard Sandiford Committed by Richard Sandiford

Remove global call sets: reload.c

The inheritance code in find_equiv_reg can use clobbers_reg_p
to test whether a call clobbers either of the equivalent registers.

reload and find_reg use crtl->abi to test whether a register needs
to be saved in the prologue before use.

reload_as_needed can use full_and_partial_reg_clobbers and thus
avoid needing to keep its own record of which registers are part
call-clobbered.

2019-09-30  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* reload.c: Include function-abi.h.
	(find_equiv_reg): Use clobbers_reg_p to test whether either
	of the equivalent registers is clobbered by a call.
	* reload1.c: Include function-abi.h.
	(reg_reloaded_call_part_clobbered): Delete.
	(reload): Use crtl->abi to test which registers would need
	saving in the prologue before use.
	(find_reg): Likewise.
	(emit_reload_insns): Remove code for reg_reloaded_call_part_clobbered.
	(reload_as_needed): Likewise.  Use full_and_partial_reg_clobbers
	instead of call_used_or_fixed_regs | reg_reloaded_call_part_clobbered.

From-SVN: r276333
parent 0ce77f46
2019-09-30 Richard Sandiford <richard.sandiford@arm.com> 2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
* reload.c: Include function-abi.h.
(find_equiv_reg): Use clobbers_reg_p to test whether either
of the equivalent registers is clobbered by a call.
* reload1.c: Include function-abi.h.
(reg_reloaded_call_part_clobbered): Delete.
(reload): Use crtl->abi to test which registers would need
saving in the prologue before use.
(find_reg): Likewise.
(emit_reload_insns): Remove code for reg_reloaded_call_part_clobbered.
(reload_as_needed): Likewise. Use full_and_partial_reg_clobbers
instead of call_used_or_fixed_regs | reg_reloaded_call_part_clobbered.
2019-09-30 Richard Sandiford <richard.sandiford@arm.com>
* regrename.h (du_head::call_clobber_mask): New field. * regrename.h (du_head::call_clobber_mask): New field.
(du_head::need_caller_save_reg): Replace with... (du_head::need_caller_save_reg): Replace with...
(du_head::call_abis): ...this new field. (du_head::call_abis): ...this new field.
......
...@@ -106,6 +106,7 @@ a register with any other reload. */ ...@@ -106,6 +106,7 @@ a register with any other reload. */
#include "reload.h" #include "reload.h"
#include "addresses.h" #include "addresses.h"
#include "params.h" #include "params.h"
#include "function-abi.h"
/* True if X is a constant that can be forced into the constant pool. /* True if X is a constant that can be forced into the constant pool.
MODE is the mode of the operand, or VOIDmode if not known. */ MODE is the mode of the operand, or VOIDmode if not known. */
...@@ -6904,23 +6905,18 @@ find_equiv_reg (rtx goal, rtx_insn *insn, enum reg_class rclass, int other, ...@@ -6904,23 +6905,18 @@ find_equiv_reg (rtx goal, rtx_insn *insn, enum reg_class rclass, int other,
if either of the two is in a call-clobbered register, or memory. */ if either of the two is in a call-clobbered register, or memory. */
if (CALL_P (p)) if (CALL_P (p))
{ {
int i;
if (goal_mem || need_stable_sp) if (goal_mem || need_stable_sp)
return 0; return 0;
if (regno >= 0 && regno < FIRST_PSEUDO_REGISTER) function_abi callee_abi = insn_callee_abi (p);
for (i = 0; i < nregs; ++i) if (regno >= 0
if (call_used_or_fixed_reg_p (regno + i) && regno < FIRST_PSEUDO_REGISTER
|| targetm.hard_regno_call_part_clobbered (0, regno + i, && callee_abi.clobbers_reg_p (mode, regno))
mode))
return 0; return 0;
if (valueno >= 0 && valueno < FIRST_PSEUDO_REGISTER) if (valueno >= 0
for (i = 0; i < valuenregs; ++i) && valueno < FIRST_PSEUDO_REGISTER
if (call_used_or_fixed_reg_p (valueno + i) && callee_abi.clobbers_reg_p (mode, valueno))
|| targetm.hard_regno_call_part_clobbered (0, valueno + i,
mode))
return 0; return 0;
} }
......
...@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "except.h" #include "except.h"
#include "dumpfile.h" #include "dumpfile.h"
#include "rtl-iter.h" #include "rtl-iter.h"
#include "function-abi.h"
/* This file contains the reload pass of the compiler, which is /* This file contains the reload pass of the compiler, which is
run after register allocation has been done. It checks that run after register allocation has been done. It checks that
...@@ -120,11 +121,6 @@ static HARD_REG_SET reg_reloaded_valid; ...@@ -120,11 +121,6 @@ static HARD_REG_SET reg_reloaded_valid;
This is only valid if reg_reloaded_contents is set and valid. */ This is only valid if reg_reloaded_contents is set and valid. */
static HARD_REG_SET reg_reloaded_dead; static HARD_REG_SET reg_reloaded_dead;
/* Indicate whether the register's current value is one that is not
safe to retain across a call, even for registers that are normally
call-saved. This is only meaningful for members of reg_reloaded_valid. */
static HARD_REG_SET reg_reloaded_call_part_clobbered;
/* Number of spill-regs so far; number of valid elements of spill_regs. */ /* Number of spill-regs so far; number of valid elements of spill_regs. */
static int n_spills; static int n_spills;
...@@ -795,7 +791,7 @@ reload (rtx_insn *first, int global) ...@@ -795,7 +791,7 @@ reload (rtx_insn *first, int global)
if (crtl->saves_all_registers) if (crtl->saves_all_registers)
for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
if (! call_used_or_fixed_reg_p (i) if (! crtl->abi->clobbers_full_reg_p (i)
&& ! fixed_regs[i] && ! fixed_regs[i]
&& ! LOCAL_REGNO (i)) && ! LOCAL_REGNO (i))
df_set_regs_ever_live (i, true); df_set_regs_ever_live (i, true);
...@@ -1908,8 +1904,8 @@ find_reg (class insn_chain *chain, int order) ...@@ -1908,8 +1904,8 @@ find_reg (class insn_chain *chain, int order)
&& (inv_reg_alloc_order[regno] && (inv_reg_alloc_order[regno]
< inv_reg_alloc_order[best_reg]) < inv_reg_alloc_order[best_reg])
#else #else
&& call_used_or_fixed_reg_p (regno) && crtl->abi->clobbers_full_reg_p (regno)
&& ! call_used_or_fixed_reg_p (best_reg) && !crtl->abi->clobbers_full_reg_p (best_reg)
#endif #endif
)) ))
{ {
...@@ -4464,7 +4460,6 @@ reload_as_needed (int live_known) ...@@ -4464,7 +4460,6 @@ reload_as_needed (int live_known)
reg_last_reload_reg = XCNEWVEC (rtx, max_regno); reg_last_reload_reg = XCNEWVEC (rtx, max_regno);
INIT_REG_SET (&reg_has_output_reload); INIT_REG_SET (&reg_has_output_reload);
CLEAR_HARD_REG_SET (reg_reloaded_valid); CLEAR_HARD_REG_SET (reg_reloaded_valid);
CLEAR_HARD_REG_SET (reg_reloaded_call_part_clobbered);
set_initial_elim_offsets (); set_initial_elim_offsets ();
...@@ -4786,8 +4781,8 @@ reload_as_needed (int live_known) ...@@ -4786,8 +4781,8 @@ reload_as_needed (int live_known)
be partially clobbered by the call. */ be partially clobbered by the call. */
else if (CALL_P (insn)) else if (CALL_P (insn))
{ {
reg_reloaded_valid &= ~(call_used_or_fixed_regs reg_reloaded_valid
| reg_reloaded_call_part_clobbered); &= ~insn_callee_abi (insn).full_and_partial_reg_clobbers ();
/* If this is a call to a setjmp-type function, we must not /* If this is a call to a setjmp-type function, we must not
reuse any reload reg contents across the call; that will reuse any reload reg contents across the call; that will
...@@ -8193,13 +8188,6 @@ emit_reload_insns (class insn_chain *chain) ...@@ -8193,13 +8188,6 @@ emit_reload_insns (class insn_chain *chain)
: out_regno + k); : out_regno + k);
reg_reloaded_insn[regno + k] = insn; reg_reloaded_insn[regno + k] = insn;
SET_HARD_REG_BIT (reg_reloaded_valid, regno + k); SET_HARD_REG_BIT (reg_reloaded_valid, regno + k);
if (targetm.hard_regno_call_part_clobbered (0, regno + k,
mode))
SET_HARD_REG_BIT (reg_reloaded_call_part_clobbered,
regno + k);
else
CLEAR_HARD_REG_BIT (reg_reloaded_call_part_clobbered,
regno + k);
} }
} }
} }
...@@ -8273,13 +8261,6 @@ emit_reload_insns (class insn_chain *chain) ...@@ -8273,13 +8261,6 @@ emit_reload_insns (class insn_chain *chain)
: in_regno + k); : in_regno + k);
reg_reloaded_insn[regno + k] = insn; reg_reloaded_insn[regno + k] = insn;
SET_HARD_REG_BIT (reg_reloaded_valid, regno + k); SET_HARD_REG_BIT (reg_reloaded_valid, regno + k);
if (targetm.hard_regno_call_part_clobbered (0, regno + k,
mode))
SET_HARD_REG_BIT (reg_reloaded_call_part_clobbered,
regno + k);
else
CLEAR_HARD_REG_BIT (reg_reloaded_call_part_clobbered,
regno + k);
} }
} }
} }
...@@ -8388,13 +8369,6 @@ emit_reload_insns (class insn_chain *chain) ...@@ -8388,13 +8369,6 @@ emit_reload_insns (class insn_chain *chain)
reg_reloaded_insn[src_regno + k] = store_insn; reg_reloaded_insn[src_regno + k] = store_insn;
CLEAR_HARD_REG_BIT (reg_reloaded_dead, src_regno + k); CLEAR_HARD_REG_BIT (reg_reloaded_dead, src_regno + k);
SET_HARD_REG_BIT (reg_reloaded_valid, src_regno + k); SET_HARD_REG_BIT (reg_reloaded_valid, src_regno + k);
if (targetm.hard_regno_call_part_clobbered
(0, src_regno + k, mode))
SET_HARD_REG_BIT (reg_reloaded_call_part_clobbered,
src_regno + k);
else
CLEAR_HARD_REG_BIT (reg_reloaded_call_part_clobbered,
src_regno + k);
SET_HARD_REG_BIT (reg_is_output_reload, src_regno + k); SET_HARD_REG_BIT (reg_is_output_reload, src_regno + k);
if (note) if (note)
SET_HARD_REG_BIT (reg_reloaded_died, src_regno); SET_HARD_REG_BIT (reg_reloaded_died, src_regno);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment