This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Turn HARD_REGNO_MODE_OK into a target hook


On 08/28/2017 03:20 AM, Richard Sandiford wrote:
> This is a bit of a workhorse macro, so it might make sense to add
> some caching around the calls.  If possible I'd like to do that
> during stage 3 (under the usual "compile time is always a bug" thing);
> we would still want this patch for that, and the patch is implementing
> an agreed policy.
> 
> The lack of function comments in msp430.c and rl78.c is deliberate;
> the local style there is to define the hook macro immediately before
> the function as a form of documentation.
> 
> Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64le-linux-gnu.
> Also tested by checking that there were no extra warnings or changes in
> testsuite assembly output for at least one target per CPU.  OK to install?
> 
> Richard
> 
> 
> 2017-08-28  Richard Sandiford  <richard.sandiford@linaro.org>
> 	    Alan Hayward  <alan.hayward@arm.com>
> 	    David Sherwood  <david.sherwood@arm.com>
> 
> gcc/
> 	* target.def (hard_regno_mode_ok): New hook.
> 	* doc/tm.texi (HARD_REGNO_MODE_OK): Replace with...
> 	(TARGET_HARD_REGNO_MODE_OK): ...this.
> 	* doc/tm.texi.in: Regenerate.
> 	* hooks.h (hook_bool_uint_mode_true): Declare.
> 	* hooks.c (hook_bool_uint_mode_true): New function.
> 	* doc/md.texi: Refer to targetm.hard_regno_mode_ok instead of
> 	HARD_REGNO_MODE_OK.
> 	* genpreds.c (write_insn_preds_c): Add an include of target.h.
> 	* alias.c (init_alias_target): Use targetm.hard_regno_mode_ok
> 	instead of HARD_REGNO_MODE_OK.
> 	* caller-save.c: Include target.h.
> 	(reg_save_code): Use targetm.hard_regno_mode_ok instead of
> 	HARD_REGNO_MODE_OK.
> 	* combine.c (can_combine_p): Likewise.
> 	(combinable_i3pat): Likewise.
> 	(can_change_dest_mode): Likewise.
> 	* expr.c (init_expr_target): Likewise.
> 	(convert_move): Likewise.
> 	(convert_modes): Likewise.
> 	* ira.c (setup_prohibited_class_mode_regs): Likewise.
> 	(setup_prohibited_mode_move_regs): Likewise.
> 	* ira.h (target_ira): Likewise.
> 	* lra-assigns.c (find_hard_regno_for_1): Likewise.
> 	* lra-constraints.c (process_alt_operands): Likewise.
> 	(split_reg): Likewise.
> 	* recog.c (peep2_find_free_register): Likewise.
> 	* ree.c (combine_reaching_defs): Likewise.
> 	* regcprop.c (maybe_mode_change): Likewise.
> 	* reginfo.c (init_reg_sets_1): Likewise.
> 	(choose_hard_reg_mode): Likewise.
> 	(simplifiable_subregs): Likewise.
> 	* regrename.c (check_new_reg_p): Likewise.
> 	* reload.c (find_valid_class): Likewise.
> 	(find_valid_class_1): Likewise.
> 	(reload_inner_reg_of_subreg): Likewise.
> 	(push_reload): Likewise.
> 	(combine_reloads): Likewise.
> 	(find_dummy_reload): Likewise.
> 	(find_reloads): Likewise.
> 	* reload1.c (find_reg): Likewise.
> 	(set_reload_reg): Likewise.
> 	(allocate_reload_reg): Likewise.
> 	(choose_reload_regs): Likewise.
> 	(reload_adjust_reg_for_temp): Likewise.
> 	* rtlanal.c (subreg_size_offset_from_lsb): Likewise.
> 	(simplify_subreg_regno): Likewise.
> 	* sel-sched.c (init_regs_for_mode): Likewise.
> 	* varasm.c (make_decl_rtl): Likewise.
> 	* config/aarch64/aarch64.h (HARD_REGNO_MODE_OK): Delete.
> 	(MODES_TIEABLE_P): Use targetm.hard_regno_mode_ok instead of
> 	HARD_REGNO_MODE_OK.
> 	* config/aarch64/aarch64-protos.h (aarch64_hard_regno_mode_ok): Delete.
> 	* config/aarch64/aarch64.c (aarch64_hard_regno_mode_ok): Make static.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/alpha/alpha.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/alpha/alpha.c (alpha_hard_regno_mode_ok): New function.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/arc/arc.h (arc_hard_regno_mode_ok): Delete.
> 	(arc_mode_class): Delete.
> 	(HARD_REGNO_MODE_OK): Delete.
> 	* config/arc/arc.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(arc_hard_regno_mode_ok): Rename old array to...
> 	(arc_hard_regno_mode_ok_modes): ...this.
> 	(arc_conditional_register_usage): Update accordingly.
> 	(arc_mode_class): Make static.
> 	(arc_hard_regno_mode_ok): New function.
> 	* config/arm/arm.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/arm/arm-protos.h (arm_hard_regno_mode_ok): Delete.
> 	* config/arm/arm.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(arm_hard_regno_mode_ok): Make static.
> 	* config/arm/arm.md (movdi): Use targetm.hard_regno_mode_ok instead of
> 	HARD_REGNO_MODE_OK.
> 	* config/avr/avr-protos.h (avr_hard_regno_mode_ok): Delete.
> 	* config/avr/avr.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/avr/avr.c (avr_hard_regno_mode_ok): Make static and
> 	return a bool.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/bfin/bfin-protos.h (hard_regno_mode_ok): Delete.
> 	* config/bfin/bfin.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/bfin/bfin.c (hard_regno_mode_ok): Rename to...
> 	(bfin_hard_regno_mode_ok): ...this.  Make static and return a bool.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/bfin/predicates.md (valid_reg_operand): Use
> 	targetm.hard_regno_mode_ok instead of HARD_REGNO_MODE_OK.
> 	* config/c6x/c6x.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/c6x/c6x.c (c6x_hard_regno_mode_ok): New function.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/cr16/cr16.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/cr16/cr16-protos.h (cr16_hard_regno_mode_ok): Delete.
> 	* config/cr16/cr16.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(cr16_hard_regno_mode_ok): Make static and return a bool.
> 	* config/cris/cris.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/cris/cris.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(cris_hard_regno_mode_ok): New function.
> 	* config/epiphany/epiphany.h (epiphany_hard_regno_mode_ok): Delete.
> 	(epiphany_mode_class): Delete.
> 	(HARD_REGNO_MODE_OK): Delete.
> 	* config/epiphany/epiphany-protos.h (hard_regno_mode_ok): Delete.
> 	* config/epiphany/epiphany.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(hard_regno_mode_ok): Rename to...
> 	(epiphany_hard_regno_mode_ok): ...this.  Make static and return a bool.
> 	* config/fr30/fr30.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/fr30/fr30.md: Refer to targetm.hard_regno_mode_ok instead of
> 	HARD_REGNO_MODE_OK.
> 	* config/frv/frv.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/frv/frv-protos.h (frv_hard_regno_mode_ok): Delete.
> 	* config/frv/frv.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(frv_hard_regno_mode_ok): Make static and return a bool.
> 	* config/frv/frv.md: Refer to targetm.hard_regno_mode_ok instead of
> 	HARD_REGNO_MODE_OK.
> 	* config/ft32/ft32.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/h8300/h8300.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/h8300/h8300-protos.h (h8300_hard_regno_mode_ok): Delete.
> 	* config/h8300/h8300.c (h8300_hard_regno_mode_ok): Make static
> 	and return a bool.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/i386/i386.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/i386/i386-protos.h (ix86_hard_regno_mode_ok): Delete.
> 	* config/i386/i386.c (ix86_hard_regno_mode_ok): Make static and
> 	return a bool.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/ia64/ia64.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/ia64/ia64.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(ia64_hard_regno_mode_ok): New function.
> 	* config/iq2000/iq2000.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/iq2000/iq2000.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(iq2000_hard_regno_mode_ok): New function.
> 	* config/lm32/lm32.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/lm32/lm32.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(lm32_hard_regno_mode_ok): New function.
> 	* config/m32c/m32c.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/m32c/m32c-protos.h (m32c_hard_regno_ok): Delete.
> 	* config/m32c/m32c.c (class_can_hold_mode): Use m32c_hard_regno_mode_ok
> 	instead of HARD_REGNO_MODE_OK.
> 	(m32c_hard_regno_ok): Rename to...
> 	(m32c_hard_regno_mode_ok): ...this.  Make static and return a bool.
> 	(m32c_cannot_change_mode_class): Update accordingly.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/m32r/m32r.h (m32r_hard_regno_mode_ok): Delete.
> 	(m32r_mode_class): Delete.
> 	(HARD_REGNO_MODE_OK): Delete.
> 	* config/m32r/m32r.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(m32r_hard_regno_mode_ok): Rename to...
> 	(m32r_hard_regno_modes): ...this.
> 	(m32r_mode_class): Make static.
> 	(m32r_hard_regno_mode_ok): New function.
> 	* config/m68k/m68k.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/m68k/m68k-protos.h (m68k_regno_mode_ok): Delete.
> 	* config/m68k/m68k.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(m68k_hard_regno_mode_ok): Make static.
> 	* config/mcore/mcore.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/mcore/mcore.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(mcore_hard_regno_mode_ok): New function.
> 	* config/microblaze/microblaze.h (microblaze_hard_regno_mode_ok)
> 	(HARD_REGNO_MODE_OK): Delete.
> 	* config/microblaze/microblaze.c (microblaze_hard_regno_mode_ok):
> 	Rename to...
> 	(microblaze_hard_regno_mode_ok_p): ...this and make static.
> 	(microblaze_hard_regno_mode_ok): New function.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/mips/mips.h (HARD_REGNO_MODE_OK): Delete.
> 	(mips_hard_regno_mode_ok): Delete.
> 	* config/mips/mips.c (mips_hard_regno_mode_ok): Rename to...
> 	(mips_hard_regno_mode_ok_p): ...this and make static.
> 	(mips_hard_regno_mode_ok_p): Rename to...
> 	(mips_hard_regno_mode_ok_uncached): ...this.
> 	(mips_hard_regno_mode_ok): New function.
> 	(mips_class_max_nregs): Use mips_hard_regno_mode_ok instead
> 	of HARD_REGNO_MODE_OK.
> 	(mips_option_override): Update after above name changes.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/mmix/mmix.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/mn10300/mn10300.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/mn10300/mn10300-protos.h (mn10300_hard_regno_mode_ok): Delete.
> 	* config/mn10300/mn10300.c (mn10300_hard_regno_mode_ok): Make static.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/moxie/moxie.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/msp430/msp430.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/msp430/msp430-protos.h (msp430_hard_regno_mode_ok): Delete.
> 	* config/msp430/msp430.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(msp430_hard_regno_mode_ok): Make static and return a bool.
> 	* config/nds32/nds32.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/nds32/nds32-protos.h (nds32_hard_regno_mode_ok): Delete.
> 	* config/nds32/nds32.c (nds32_hard_regno_mode_ok): Make static
> 	and return a bool.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/nios2/nios2.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/nvptx/nvptx.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/pa/pa.h (MODES_TIEABLE_P): Update commentary.
> 	* config/pa/pa32-regs.h (HARD_REGNO_MODE_OK): Rename to...
> 	(PA_HARD_REGNO_MODE_OK): ...this
> 	* config/pa/pa64-regs.h (HARD_REGNO_MODE_OK): Rename to...
> 	(PA_HARD_REGNO_MODE_OK): ...this.
> 	* config/pa/pa.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(pa_hard_regno_mode_ok): New function.
> 	* config/pdp11/pdp11.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/pdp11/pdp11.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(pdp11_hard_regno_mode_ok): New function.
> 	* config/powerpcspe/powerpcspe.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/powerpcspe/powerpcspe-protos.h (rs6000_hard_regno_mode_ok_p):
> 	Delete.
> 	* config/powerpcspe/powerpcspe.c (rs6000_hard_regno_mode_ok_p):
> 	Make static.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(rs6000_hard_regno_mode_ok): Rename to...
> 	(rs6000_hard_regno_mode_ok_uncached): ...this.
> 	(rs6000_init_hard_regno_mode_ok): Update accordingly.
> 	(rs6000_hard_regno_mode_ok): New function.
> 	* config/riscv/riscv.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/riscv/riscv-protos.h (riscv_hard_regno_mode_ok_p): Delete.
> 	* config/riscv/riscv.c (riscv_hard_regno_mode_ok_p): Rename to...
> 	(riscv_hard_regno_mode_ok): ...this and make static.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/rl78/rl78.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/rl78/rl78-protos.h (rl78_hard_regno_mode_ok): Delete.
> 	* config/rl78/rl78.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(rl78_hard_regno_mode_ok): Make static and return bool.
> 	* config/rs6000/rs6000.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/rs6000/rs6000-protos.h (rs6000_hard_regno_mode_ok_p):
> 	Delete.
> 	* config/rs6000/rs6000.c (rs6000_hard_regno_mode_ok_p): Make static.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(rs6000_hard_regno_mode_ok): Rename to...
> 	(rs6000_hard_regno_mode_ok_uncached): ...this.
> 	(rs6000_init_hard_regno_mode_ok): Update accordingly.
> 	(rs6000_hard_regno_mode_ok): New function.
> 	* config/rx/rx.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/rx/rx.c (rx_hard_regno_mode_ok): New function.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/s390/s390.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/s390/s390-protos.h (s390_hard_regno_mode_ok): Delete.
> 	* config/s390/s390.c (s390_hard_regno_mode_ok): Make static.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/sh/sh.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/sh/sh-protos.h (sh_hard_regno_mode_ok): Delete.
> 	* config/sh/sh.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(sh_hard_regno_mode_ok): Make static.
> 	* config/sparc/constraints.md: Refer to targetm.hard_regno_mode_ok
> 	instead of HARD_REGNO_MODE_OK.
> 	* config/sparc/sparc.h (hard_regno_mode_classes): Delete.
> 	(sparc_mode_class): Delete.
> 	(HARD_REGNO_MODE_OK): Delete.
> 	* config/sparc/sparc.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(hard_regno_mode_classes): Make static.
> 	(sparc_mode_class): Likewise.
> 	(sparc_hard_regno_mode_ok): New function.
> 	* config/spu/spu.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/stormy16/stormy16.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/stormy16/stormy16.c (xstormy16_hard_regno_mode_ok): New
> 	function.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/tilegx/tilegx.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/tilepro/tilepro.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/v850/v850.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/v850/v850.c (v850_hard_regno_mode_ok): New function.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	* config/vax/vax.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/visium/visium.h (HARD_REGNO_MODE_OK): Delete.
> 	* config/visium/visium.c (TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(visium_hard_regno_mode_ok): New function.
> 	* config/visium/visium.md: Refer to targetm.hard_regno_mode_ok
> 	instead of HARD_REGNO_MODE_OK.
> 	* config/xtensa/xtensa.h (xtensa_hard_regno_mode_ok): Delete.
> 	(HARD_REGNO_MODE_OK): Delete.
> 	* config/xtensa/xtensa.c (xtensa_hard_regno_mode_ok): Rename to...
> 	(xtensa_hard_regno_mode_ok_p): ...this and make static.
> 	(xtensa_option_override): Update accordingly.
> 	(TARGET_HARD_REGNO_MODE_OK): Redefine.
> 	(xtensa_hard_regno_mode_ok): New function.
> 	* system.h (HARD_REGNO_MODE_OK): Poison.
OK.  Not sure if we're going to need the cache or not -- I'll leave that
up to you to decide.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]