diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-09-04 10:49:21 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-09-04 10:49:21 +0000 |
commit | 80ec73f4ee2bcf4b2338eefe3521940ab0fd6dc4 (patch) | |
tree | 0d5d88cd2bf9a5c1f0f18848ddc0092b0884a2d7 /gcc/doc | |
parent | 3d09ba95c150d9676f9a2585fb61315e86fa644a (diff) | |
download | gcc-80ec73f4ee2bcf4b2338eefe3521940ab0fd6dc4.zip gcc-80ec73f4ee2bcf4b2338eefe3521940ab0fd6dc4.tar.gz gcc-80ec73f4ee2bcf4b2338eefe3521940ab0fd6dc4.tar.bz2 |
Turn HARD_REGNO_CALL_PART_CLOBBERED into a target hook
The SVE patches change the size of a machine_mode from a compile-time
constant to a runtime invariant. However, target-specific code can
continue to treat the modes as constant-sized if the target only has
constant-sized modes.
The main snag with this approach is that target-independent code still
uses macros from the target .h file. This patch is one of several that
converts a target macro to a hook.
2017-09-04 Richard Sandiford <richard.sandiford@linaro.org>
Alan Hayward <alan.hayward@arm.com>
David Sherwood <david.sherwood@arm.com>
gcc/
* target.def (hard_regno_call_part_clobbered): New hook.
* doc/tm.texi.in (HARD_REGNO_CALL_PART_CLOBBERED): Replace with...
(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): ...this hook.
* doc/tm.texi: Regenerate.
* hooks.h (hook_bool_uint_mode_false): Declare.
* hooks.c (hook_bool_uint_mode_false): New function.
* regs.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
* cselib.c (cselib_process_insn): Use
targetm.hard_regno_call_part_clobbered instead of
HARD_REGNO_CALL_PART_CLOBBERED.
* ira-conflicts.c (ira_build_conflicts): Likewise.
* ira-costs.c (ira_tune_allocno_costs): Likewise.
* lra-constraints.c (need_for_call_save_p): Likewise.
* lra-lives.c: Include target.h.
(check_pseudos_live_through_calls): Use
targetm.hard_regno_call_part_clobbered instead of
HARD_REGNO_CALL_PART_CLOBBERED.
* regcprop.c: Include target.h.
(copyprop_hardreg_forward_1): Use
targetm.hard_regno_call_part_clobbered instead of
HARD_REGNO_CALL_PART_CLOBBERED.
* reginfo.c (choose_hard_reg_mode): Likewise.
* regrename.c (check_new_reg_p): Likewise.
* reload.c (find_equiv_reg): Likewise.
* reload1.c (emit_reload_insns): Likewise.
* sched-deps.c (deps_analyze_insn): Likewise.
* sel-sched.c (init_regs_for_mode): Likewise.
(mark_unavailable_hard_regs): Likewise.
* targhooks.c (default_dwarf_frame_reg_mode): Likewise.
* config/aarch64/aarch64.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
* config/aarch64/aarch64.c (aarch64_hard_regno_call_part_clobbered):
New function.
(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
* config/avr/avr.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
* config/avr/avr-protos.h (avr_hard_regno_call_part_clobbered):
Delete.
* config/avr/avr.c (avr_hard_regno_call_part_clobbered): Make static
and return a bool.
(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
* config/i386/i386.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
* config/i386/i386.c (ix86_hard_regno_call_part_clobbered): New
function.
(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
* config/mips/mips.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
* config/mips/mips.c (mips_hard_regno_call_part_clobbered): New
function.
(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
* config/powerpcspe/powerpcspe.h (HARD_REGNO_CALL_PART_CLOBBERED):
Delete.
* config/powerpcspe/powerpcspe.c
(rs6000_hard_regno_call_part_clobbered): New function.
(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
* config/rs6000/rs6000.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
* config/rs6000/rs6000.c (rs6000_hard_regno_call_part_clobbered):
New function.
(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
* config/s390/s390.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
* config/s390/s390.c (s390_hard_regno_call_part_clobbered): New
function.
(TARGET_HARD_REGNO_CALL_PART_CLOBBERED): Redefine.
* config/sh/sh.h (HARD_REGNO_CALL_PART_CLOBBERED): Delete.
* system.h (HARD_REGNO_CALL_PART_CLOBBERED): Poison.
Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251645
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/tm.texi | 17 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 8 |
2 files changed, 11 insertions, 14 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index ae51e75..0c77b53 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -1869,16 +1869,19 @@ This macro is optional. If not specified, it defaults to the value of @code{CALL_USED_REGISTERS}. @end defmac -@defmac HARD_REGNO_CALL_PART_CLOBBERED (@var{regno}, @var{mode}) @cindex call-used register @cindex call-clobbered register @cindex call-saved register -A C expression that is nonzero if it is not permissible to store a -value of mode @var{mode} in hard register number @var{regno} across a -call without some part of it being clobbered. For most machines this -macro need not be defined. It is only required for machines that do not -preserve the entire contents of a register across a call. -@end defmac +@deftypefn {Target Hook} bool TARGET_HARD_REGNO_CALL_PART_CLOBBERED (unsigned int @var{regno}, machine_mode @var{mode}) +This hook should return true if @var{regno} is partly call-saved and +partly call-clobbered, and if a value of mode @var{mode} would be partly +clobbered by a call. For example, if the low 32 bits of @var{regno} are +preserved across a call but higher bits are clobbered, this hook should +return true for a 64-bit mode but false for a 32-bit mode. + +The default implementation returns false, which is correct +for targets that don't have partly call-clobbered registers. +@end deftypefn @findex fixed_regs @findex call_used_regs diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 6df08a2..3fec545 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -1698,16 +1698,10 @@ This macro is optional. If not specified, it defaults to the value of @code{CALL_USED_REGISTERS}. @end defmac -@defmac HARD_REGNO_CALL_PART_CLOBBERED (@var{regno}, @var{mode}) @cindex call-used register @cindex call-clobbered register @cindex call-saved register -A C expression that is nonzero if it is not permissible to store a -value of mode @var{mode} in hard register number @var{regno} across a -call without some part of it being clobbered. For most machines this -macro need not be defined. It is only required for machines that do not -preserve the entire contents of a register across a call. -@end defmac +@hook TARGET_HARD_REGNO_CALL_PART_CLOBBERED @findex fixed_regs @findex call_used_regs |