]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Turn HARD_REGNO_MODE_OK into a target hook
authorRichard Sandiford <richard.sandiford@linaro.org>
Mon, 4 Sep 2017 10:49:59 +0000 (10:49 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 4 Sep 2017 10:49:59 +0000 (10:49 +0000)
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_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.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r251646

143 files changed:
gcc/ChangeLog
gcc/alias.c
gcc/caller-save.c
gcc/combine.c
gcc/config/aarch64/aarch64-protos.h
gcc/config/aarch64/aarch64.c
gcc/config/aarch64/aarch64.h
gcc/config/alpha/alpha.c
gcc/config/alpha/alpha.h
gcc/config/arc/arc.c
gcc/config/arc/arc.h
gcc/config/arm/arm-protos.h
gcc/config/arm/arm.c
gcc/config/arm/arm.h
gcc/config/arm/arm.md
gcc/config/avr/avr-protos.h
gcc/config/avr/avr.c
gcc/config/avr/avr.h
gcc/config/bfin/bfin-protos.h
gcc/config/bfin/bfin.c
gcc/config/bfin/bfin.h
gcc/config/bfin/predicates.md
gcc/config/c6x/c6x.c
gcc/config/c6x/c6x.h
gcc/config/cr16/cr16-protos.h
gcc/config/cr16/cr16.c
gcc/config/cr16/cr16.h
gcc/config/cris/cris.c
gcc/config/cris/cris.h
gcc/config/epiphany/epiphany-protos.h
gcc/config/epiphany/epiphany.c
gcc/config/epiphany/epiphany.h
gcc/config/fr30/fr30.h
gcc/config/fr30/fr30.md
gcc/config/frv/frv-protos.h
gcc/config/frv/frv.c
gcc/config/frv/frv.h
gcc/config/frv/frv.md
gcc/config/ft32/ft32.h
gcc/config/h8300/h8300-protos.h
gcc/config/h8300/h8300.c
gcc/config/h8300/h8300.h
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c
gcc/config/i386/i386.h
gcc/config/ia64/ia64.c
gcc/config/ia64/ia64.h
gcc/config/iq2000/iq2000.c
gcc/config/iq2000/iq2000.h
gcc/config/lm32/lm32.c
gcc/config/lm32/lm32.h
gcc/config/m32c/m32c-protos.h
gcc/config/m32c/m32c.c
gcc/config/m32c/m32c.h
gcc/config/m32r/m32r.c
gcc/config/m32r/m32r.h
gcc/config/m68k/m68k-protos.h
gcc/config/m68k/m68k.c
gcc/config/m68k/m68k.h
gcc/config/mcore/mcore.c
gcc/config/mcore/mcore.h
gcc/config/microblaze/microblaze.c
gcc/config/microblaze/microblaze.h
gcc/config/mips/mips.c
gcc/config/mips/mips.h
gcc/config/mmix/mmix.h
gcc/config/mn10300/mn10300-protos.h
gcc/config/mn10300/mn10300.c
gcc/config/mn10300/mn10300.h
gcc/config/moxie/moxie.h
gcc/config/msp430/msp430-protos.h
gcc/config/msp430/msp430.c
gcc/config/msp430/msp430.h
gcc/config/nds32/nds32-protos.h
gcc/config/nds32/nds32.c
gcc/config/nds32/nds32.h
gcc/config/nios2/nios2.h
gcc/config/nvptx/nvptx.h
gcc/config/pa/pa.c
gcc/config/pa/pa.h
gcc/config/pa/pa32-regs.h
gcc/config/pa/pa64-regs.h
gcc/config/pdp11/pdp11.c
gcc/config/pdp11/pdp11.h
gcc/config/powerpcspe/powerpcspe-protos.h
gcc/config/powerpcspe/powerpcspe.c
gcc/config/powerpcspe/powerpcspe.h
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv.c
gcc/config/riscv/riscv.h
gcc/config/rl78/rl78-protos.h
gcc/config/rl78/rl78.c
gcc/config/rl78/rl78.h
gcc/config/rs6000/rs6000-protos.h
gcc/config/rs6000/rs6000.c
gcc/config/rs6000/rs6000.h
gcc/config/rx/rx.c
gcc/config/rx/rx.h
gcc/config/s390/s390-protos.h
gcc/config/s390/s390.c
gcc/config/s390/s390.h
gcc/config/sh/sh-protos.h
gcc/config/sh/sh.c
gcc/config/sh/sh.h
gcc/config/sparc/constraints.md
gcc/config/sparc/sparc.c
gcc/config/sparc/sparc.h
gcc/config/spu/spu.h
gcc/config/stormy16/stormy16.c
gcc/config/stormy16/stormy16.h
gcc/config/tilegx/tilegx.h
gcc/config/tilepro/tilepro.h
gcc/config/v850/v850.c
gcc/config/v850/v850.h
gcc/config/vax/vax.h
gcc/config/visium/visium.c
gcc/config/visium/visium.h
gcc/config/visium/visium.md
gcc/config/xtensa/xtensa.c
gcc/config/xtensa/xtensa.h
gcc/doc/md.texi
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/expr.c
gcc/genpreds.c
gcc/hooks.c
gcc/hooks.h
gcc/ira.c
gcc/ira.h
gcc/lra-assigns.c
gcc/lra-constraints.c
gcc/recog.c
gcc/ree.c
gcc/regcprop.c
gcc/reginfo.c
gcc/regrename.c
gcc/reload.c
gcc/reload1.c
gcc/rtlanal.c
gcc/sel-sched.c
gcc/system.h
gcc/target.def
gcc/varasm.c

index 1c5100173ee5137f5e3f23d88797445da72880a9..b0f5212665d39abaf5c6408b629d74dcf5fcb9ee 100644 (file)
@@ -1,3 +1,279 @@
+2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>
+           Alan Hayward  <alan.hayward@arm.com>
+           David Sherwood  <david.sherwood@arm.com>
+
+       * 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.
+
 2017-09-04  Richard Sandiford  <richard.sandiford@linaro.org>
            Alan Hayward  <alan.hayward@arm.com>
            David Sherwood  <david.sherwood@arm.com>
index cff4fac26ed4e82995d76ef6af33799ab8fad53b..e4865729a9b5685488cca5f516789b44b04d0a71 100644 (file)
@@ -3186,7 +3186,7 @@ init_alias_target (void)
        argument.  FUNCTION_ARG_REGNO_P tests outgoing register
        numbers, so translate if necessary due to register windows.  */
     if (FUNCTION_ARG_REGNO_P (OUTGOING_REGNO (i))
-       && HARD_REGNO_MODE_OK (i, Pmode))
+       && targetm.hard_regno_mode_ok (i, Pmode))
       static_reg_base_value[i] = arg_base_value;
 
   static_reg_base_value[STACK_POINTER_REGNUM]
index 65a498d0d0cc499f4c0d8ff8f3b595da3c156994..5e6b92b0b8d4fe0fcfd242c7492a81bfe155c545 100644 (file)
@@ -36,6 +36,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "addresses.h"
 #include "dumpfile.h"
 #include "rtl-iter.h"
+#include "target.h"
 
 #define MOVE_MAX_WORDS (MOVE_MAX / UNITS_PER_WORD)
 
@@ -111,11 +112,11 @@ reg_save_code (int reg, machine_mode mode)
   bool ok;
   if (cached_reg_save_code[reg][mode])
      return cached_reg_save_code[reg][mode];
-  if (!HARD_REGNO_MODE_OK (reg, mode))
+  if (!targetm.hard_regno_mode_ok (reg, mode))
     {
-      /* Depending on how HARD_REGNO_MODE_OK is defined, range propagation
-        might deduce here that reg >= FIRST_PSEUDO_REGISTER.  So the assert
-        below silences a warning.  */
+      /* Depending on how targetm.hard_regno_mode_ok is defined, range
+        propagation might deduce here that reg >= FIRST_PSEUDO_REGISTER.
+        So the assert below silences a warning.  */
       gcc_assert (reg < FIRST_PSEUDO_REGISTER);
       cached_reg_save_code[reg][mode] = -1;
       cached_reg_restore_code[reg][mode] = -1;
index c748c92d2eda7f8a35de905a6d02fec43fe41986..4a3b4d62fc026bea298d0dd8373fce5e9363ef78 100644 (file)
@@ -2011,7 +2011,7 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED,
 
       if (REG_P (src)
          && ((REGNO (dest) < FIRST_PSEUDO_REGISTER
-              && ! HARD_REGNO_MODE_OK (REGNO (dest), GET_MODE (dest)))
+              && !targetm.hard_regno_mode_ok (REGNO (dest), GET_MODE (dest)))
              /* Don't extend the life of a hard register unless it is
                 user variable (if we have few registers) or it can't
                 fit into the desired register (meaning something special
@@ -2020,7 +2020,8 @@ can_combine_p (rtx_insn *insn, rtx_insn *i3, rtx_insn *pred ATTRIBUTE_UNUSED,
                 reload can't handle a conflict with constraints of other
                 inputs.  */
              || (REGNO (src) < FIRST_PSEUDO_REGISTER
-                 && ! HARD_REGNO_MODE_OK (REGNO (src), GET_MODE (src)))))
+                 && !targetm.hard_regno_mode_ok (REGNO (src),
+                                                 GET_MODE (src)))))
        return 0;
     }
   else if (GET_CODE (dest) != CC0)
@@ -2210,8 +2211,8 @@ combinable_i3pat (rtx_insn *i3, rtx *loc, rtx i2dest, rtx i1dest, rtx i0dest,
 
          || (REG_P (inner_dest)
              && REGNO (inner_dest) < FIRST_PSEUDO_REGISTER
-             && (! HARD_REGNO_MODE_OK (REGNO (inner_dest),
-                                       GET_MODE (inner_dest))))
+             && !targetm.hard_regno_mode_ok (REGNO (inner_dest),
+                                             GET_MODE (inner_dest)))
          || (i1_not_in_src && reg_overlap_mentioned_p (i1dest, src))
          || (i0_not_in_src && reg_overlap_mentioned_p (i0dest, src)))
        return 0;
@@ -2454,7 +2455,7 @@ can_change_dest_mode (rtx x, int added_sets, machine_mode mode)
   /* Allow hard registers if the new mode is legal, and occupies no more
      registers than the old mode.  */
   if (regno < FIRST_PSEUDO_REGISTER)
-    return (HARD_REGNO_MODE_OK (regno, mode)
+    return (targetm.hard_regno_mode_ok (regno, mode)
            && REG_NREGS (x) >= hard_regno_nregs[regno][mode]);
 
   /* Or a pseudo that is only used once.  */
index beff28e2272b7c771c5ae5f3e17f10fc5f9711d0..88c0e687037187d0171700de29524d26a263f3a2 100644 (file)
@@ -375,7 +375,6 @@ int aarch64_asm_preferred_eh_data_format (int, int);
 int aarch64_fpconst_pow_of_2 (rtx);
 machine_mode aarch64_hard_regno_caller_save_mode (unsigned, unsigned,
                                                       machine_mode);
-int aarch64_hard_regno_mode_ok (unsigned, machine_mode);
 int aarch64_hard_regno_nregs (unsigned, machine_mode);
 int aarch64_uxt_size (int, HOST_WIDE_INT);
 int aarch64_vec_fpconst_pow_of_2 (rtx);
index ba48b28d1d54af52a0921e9f180af863b11e24ca..f10a42cc4e824fafb7cd3e64c454eb6e5082f58d 100644 (file)
@@ -1083,9 +1083,9 @@ aarch64_hard_regno_nregs (unsigned regno, machine_mode mode)
   gcc_unreachable ();
 }
 
-/* Implement HARD_REGNO_MODE_OK.  */
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
 
-int
+static bool
 aarch64_hard_regno_mode_ok (unsigned regno, machine_mode mode)
 {
   if (GET_MODE_CLASS (mode) == MODE_CC)
@@ -1101,7 +1101,7 @@ aarch64_hard_regno_mode_ok (unsigned regno, machine_mode mode)
     return mode == Pmode;
 
   if (GP_REGNUM_P (regno) && ! aarch64_vect_struct_mode_p (mode))
-    return 1;
+    return true;
 
   if (FP_REGNUM_P (regno))
     {
@@ -1109,10 +1109,10 @@ aarch64_hard_regno_mode_ok (unsigned regno, machine_mode mode)
        return
          (regno + aarch64_hard_regno_nregs (regno, mode) - 1) <= V31_REGNUM;
       else
-       return 1;
+       return true;
     }
 
-  return 0;
+  return false;
 }
 
 /* Implement TARGET_HARD_REGNO_CALL_PART_CLOBBERED.  The callee only saves
@@ -15669,6 +15669,9 @@ aarch64_libgcc_floating_mode_supported_p
 #undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS
 #define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 4
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK aarch64_hard_regno_mode_ok
+
 #undef TARGET_HARD_REGNO_CALL_PART_CLOBBERED
 #define TARGET_HARD_REGNO_CALL_PART_CLOBBERED \
   aarch64_hard_regno_call_part_clobbered
index fd5d53d51b28ef2d23f8dc05a6ed04d8c56d68cd..87f01e643445427a52660b3dfe96d336dacbf9d7 100644 (file)
@@ -403,8 +403,6 @@ extern unsigned aarch64_architecture_version;
 
 #define HARD_REGNO_NREGS(REGNO, MODE)  aarch64_hard_regno_nregs (REGNO, MODE)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE)        aarch64_hard_regno_mode_ok (REGNO, MODE)
-
 #define MODES_TIEABLE_P(MODE1, MODE2) aarch64_modes_tieable_p (MODE1, MODE2)
 
 #define DWARF2_UNWIND_INFO 1
index cbcfc0151653c02d1359f013aeb0071260abdeff..bcb949955203dc8d3e54a5a17493640019a15e25 100644 (file)
@@ -9891,6 +9891,22 @@ alpha_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
                    build2 (COMPOUND_EXPR, void_type_node,
                            reload_fenv, restore_fnenv), update_call);
 }
+
+/* Implement TARGET_HARD_REGNO_MODE_OK.  On Alpha, the integer registers
+   can hold any mode.  The floating-point registers can hold 64-bit
+   integers as well, but not smaller values.  */
+
+static bool
+alpha_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  if (IN_RANGE (regno, 32, 62))
+    return (mode == SFmode
+           || mode == DFmode
+           || mode == DImode
+           || mode == SCmode
+           || mode == DCmode);
+  return true;
+}
 \f
 /* Initialize the GCC target structure.  */
 #if TARGET_ABI_OPEN_VMS
@@ -10085,6 +10101,9 @@ alpha_atomic_assign_expand_fenv (tree *hold, tree *clear, tree *update)
 #undef TARGET_ATOMIC_ASSIGN_EXPAND_FENV
 #define TARGET_ATOMIC_ASSIGN_EXPAND_FENV alpha_atomic_assign_expand_fenv
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK alpha_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 \f
index 460e83715d9ba7e453215e81cd24137585d11555..438c348d97a616c403ea0a8cfe87c73c35a3d53a 100644 (file)
@@ -385,16 +385,6 @@ extern enum alpha_fp_trap_mode alpha_fptm;
 #define HARD_REGNO_NREGS(REGNO, MODE)   \
   CEIL (GET_MODE_SIZE (MODE), UNITS_PER_WORD)
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
-   On Alpha, the integer registers can hold any mode.  The floating-point
-   registers can hold 64-bit integers as well, but not smaller values.  */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                                \
-  (IN_RANGE ((REGNO), 32, 62)                                          \
-   ? (MODE) == SFmode || (MODE) == DFmode || (MODE) == DImode          \
-     || (MODE) == SCmode || (MODE) == DCmode                           \
-   : 1)
-
 /* A C expression that is nonzero if a value of mode
    MODE1 is accessible in mode MODE2 without copying.
 
@@ -402,8 +392,8 @@ extern enum alpha_fp_trap_mode alpha_fptm;
    in an FP register but MODE2 could not.  */
 
 #define MODES_TIEABLE_P(MODE1, MODE2)                          \
-  (HARD_REGNO_MODE_OK (32, (MODE1))                            \
-   ? HARD_REGNO_MODE_OK (32, (MODE2))                          \
+  (targetm.hard_regno_mode_ok (32, (MODE1))                    \
+   ? targetm.hard_regno_mode_ok (32, (MODE2))                  \
    : 1)
 
 /* Specify the registers used for certain standard purposes.
index 9704240b50776950261f94693b063663614fa808..3438980d1c3758fe56ca728ed58cf192015b459a 100644 (file)
@@ -590,6 +590,9 @@ static void arc_finalize_pic (void);
 #undef TARGET_DWARF_REGISTER_SPAN
 #define TARGET_DWARF_REGISTER_SPAN arc_dwarf_register_span
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK arc_hard_regno_mode_ok
+
 /* Try to keep the (mov:DF _, reg) as early as possible so
    that the d<add/sub/mul>h-lr insns appear together and can
    use the peephole2 pattern.  */
@@ -1483,7 +1486,7 @@ enum arc_mode_class {
 
 /* Value is 1 if register/mode pair is acceptable on arc.  */
 
-unsigned int arc_hard_regno_mode_ok[] = {
+static unsigned int arc_hard_regno_modes[] = {
   T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES,
   T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES,
   T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, D_MODES,
@@ -1509,7 +1512,7 @@ unsigned int arc_hard_regno_mode_ok[] = {
   S_MODES, S_MODES, S_MODES, S_MODES, S_MODES, S_MODES, S_MODES, S_MODES
 };
 
-unsigned int arc_mode_class [NUM_MACHINE_MODES];
+static unsigned int arc_mode_class [NUM_MACHINE_MODES];
 
 enum reg_class arc_regno_reg_class[FIRST_PSEUDO_REGISTER];
 
@@ -1730,10 +1733,10 @@ arc_conditional_register_usage (void)
          CLEAR_HARD_REG_BIT (reg_class_contents[WRITABLE_CORE_REGS], LP_COUNT);
 
          /* Instead of taking out SF_MODE like below, forbid it outright.  */
-         arc_hard_regno_mode_ok[60] = 0;
+         arc_hard_regno_modes[60] = 0;
        }
       else
-       arc_hard_regno_mode_ok[60] = 1 << (int) S_MODE;
+       arc_hard_regno_modes[60] = 1 << (int) S_MODE;
     }
 
   /* ARCHS has 64-bit data-path which makes use of the even-odd paired
@@ -1742,7 +1745,7 @@ arc_conditional_register_usage (void)
     {
       for (regno = 1; regno < 32; regno +=2)
        {
-         arc_hard_regno_mode_ok[regno] = S_MODES;
+         arc_hard_regno_modes[regno] = S_MODES;
        }
     }
 
@@ -1820,8 +1823,8 @@ arc_conditional_register_usage (void)
       fixed_regs[42] = 1;
       fixed_regs[43] = 1;
 
-      arc_hard_regno_mode_ok[40] = 0;
-      arc_hard_regno_mode_ok[42] = 0;
+      arc_hard_regno_modes[40] = 0;
+      arc_hard_regno_modes[42] = 0;
 
       CLEAR_HARD_REG_SET(reg_class_contents [DOUBLE_REGS]);
     }
@@ -1867,10 +1870,18 @@ arc_conditional_register_usage (void)
     fixed_regs[ACCL_REGNO] = 0;
     fixed_regs[ACCH_REGNO] = 0;
 
-    arc_hard_regno_mode_ok[ACC_REG_FIRST] = D_MODES;
+    arc_hard_regno_modes[ACC_REG_FIRST] = D_MODES;
   }
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+arc_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return (arc_hard_regno_modes[regno] & arc_mode_class[mode]) != 0;
+}
+
 /* Handle an "interrupt" attribute; arguments as in
    struct attribute_spec.handler.  */
 
index ad26de71d20b630f9af616d4dac4157cde7672cd..10532c4fc7e2c4dd254ed0556baa26fbd75e1db1 100644 (file)
@@ -450,19 +450,13 @@ if (GET_MODE_CLASS (MODE) == MODE_INT             \
   && REGNO >= ARC_FIRST_SIMD_VR_REG && REGNO <= ARC_LAST_SIMD_VR_REG) ? 1 \
  : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.  */
-extern unsigned int arc_hard_regno_mode_ok[];
-extern unsigned int arc_mode_class[];
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-((arc_hard_regno_mode_ok[REGNO] & arc_mode_class[MODE]) != 0)
-
 /* A C expression that is nonzero if it is desirable to choose
    register allocation so as to avoid move instructions between a
    value of mode MODE1 and a value of mode MODE2.
 
-   If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
-   MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
-   MODE2)' must be zero.  */
+   If `TARGET_HARD_REGNO_MODE_OK (R, MODE1)' and
+   `TARGET_HARD_REGNO_MODE_OK (R, MODE2)' are ever different for any R,
+   then `TARGET_MODES_TIEABLE_P (MODE1, MODE2)' must be zero.  */
 
 /* Tie QI/HI/SI modes together.  */
 #define MODES_TIEABLE_P(MODE1, MODE2) \
index 25fb10c32d1e227c5089c893460c54daf3e51de9..189af348c1aef5bf08ffab27ad8cd5fc2f223481 100644 (file)
@@ -61,7 +61,6 @@ extern void arm_gen_unlikely_cbranch (enum rtx_code, machine_mode cc_mode,
                                      rtx label_ref);
 extern bool arm_vector_mode_supported_p (machine_mode);
 extern bool arm_small_register_classes_for_mode_p (machine_mode);
-extern int arm_hard_regno_mode_ok (unsigned int, machine_mode);
 extern bool arm_modes_tieable_p (machine_mode, machine_mode);
 extern int const_ok_for_arm (HOST_WIDE_INT);
 extern int const_ok_for_op (HOST_WIDE_INT, enum rtx_code);
index b27853464a55dcf22339298da30431aba900180e..3c6c56ccdb5ae5f50ec90b0a1d02bfe40385ead2 100644 (file)
@@ -313,6 +313,7 @@ static unsigned int arm_elf_section_type_flags (tree decl, const char *name,
                                                int reloc);
 static void arm_expand_divmod_libfunc (rtx, machine_mode, rtx, rtx, rtx *, rtx *);
 static opt_scalar_float_mode arm_floatn_mode (int, bool);
+static bool arm_hard_regno_mode_ok (unsigned int, machine_mode);
 \f
 /* Table of machine attributes.  */
 static const struct attribute_spec arm_attribute_table[] =
@@ -780,6 +781,8 @@ static const struct attribute_spec arm_attribute_table[] =
 #undef TARGET_FIXED_CONDITION_CODE_REGS
 #define TARGET_FIXED_CONDITION_CODE_REGS arm_fixed_condition_code_regs
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK arm_hard_regno_mode_ok
 \f
 /* Obstack for minipool constant handling.  */
 static struct obstack minipool_obstack;
@@ -23344,9 +23347,8 @@ thumb2_asm_output_opcode (FILE * stream)
     }
 }
 
-/* Returns true if REGNO is a valid register
-   for holding a quantity of type MODE.  */
-int
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+static bool
 arm_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   if (GET_MODE_CLASS (mode) == MODE_CC)
@@ -23390,7 +23392,7 @@ arm_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
               || (mode == CImode && NEON_REGNO_OK_FOR_NREGS (regno, 6))
               || (mode == XImode && NEON_REGNO_OK_FOR_NREGS (regno, 8));
 
-      return FALSE;
+      return false;
     }
 
   if (TARGET_REALLY_IWMMXT)
@@ -23409,10 +23411,10 @@ arm_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
   if (regno <= LAST_ARM_REGNUM)
     {
       if (ARM_NUM_REGS (mode) > 4)
-         return FALSE;
+       return false;
 
       if (TARGET_THUMB2)
-       return TRUE;
+       return true;
 
       return !(TARGET_LDRD && GET_MODE_SIZE (mode) > 4 && (regno & 1) != 0);
     }
@@ -23422,7 +23424,7 @@ arm_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
     /* We only allow integers in the fake hard registers.  */
     return GET_MODE_CLASS (mode) == MODE_INT;
 
-  return FALSE;
+  return false;
 }
 
 /* Implement MODES_TIEABLE_P.  */
index 4f53583cf0219de4329bc64a47a5a42c550ff354..4385b7dcf00e102f1b078c5dfd6ee3224f5a2bd1 100644 (file)
@@ -990,10 +990,6 @@ extern int arm_arch_cmse;
     && !IS_VFP_REGNUM (REGNO)          \
    ? 1 : ARM_NUM_REGS (MODE))
 
-/* Return true if REGNO is suitable for holding a quantity of type MODE.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                                        \
-  arm_hard_regno_mode_ok ((REGNO), (MODE))
-
 #define MODES_TIEABLE_P(MODE1, MODE2) arm_modes_tieable_p (MODE1, MODE2)
 
 #define VALID_IWMMXT_REG_MODE(MODE) \
index 242b65b6fdae0bb00ecbba2a10595ac42c7af62d..6380c69df624060dc745ebd238dc119233d5643b 100644 (file)
        operands[1] = force_reg (DImode, operands[1]);
     }
   if (REG_P (operands[0]) && REGNO (operands[0]) <= LAST_ARM_REGNUM
-      && !HARD_REGNO_MODE_OK (REGNO (operands[0]), DImode))
+      && !targetm.hard_regno_mode_ok (REGNO (operands[0]), DImode))
     {
       /* Avoid LDRD's into an odd-numbered register pair in ARM state
         when expanding function calls.  */
       DONE;
     }
   else if (REG_P (operands[1]) && REGNO (operands[1]) <= LAST_ARM_REGNUM
-          && !HARD_REGNO_MODE_OK (REGNO (operands[1]), DImode))
+          && !targetm.hard_regno_mode_ok (REGNO (operands[1]), DImode))
     {
       /* Avoid STRD's from an odd-numbered register pair in ARM state
         when expanding function prologue.  */
index f9116e6bf30e688b67a7e91a6cd0542101769279..e4306ea5d63f5b2649276edd67d8ca4568ca259e 100644 (file)
@@ -111,7 +111,6 @@ extern int avr_jump_mode (rtx x, rtx_insn *insn);
 extern int test_hard_reg_class (enum reg_class rclass, rtx x);
 extern int jump_over_one_insn_p (rtx_insn *insn, rtx dest);
 
-extern int avr_hard_regno_mode_ok (int regno, machine_mode mode);
 extern void avr_final_prescan_insn (rtx_insn *insn, rtx *operand,
                                    int num_operands);
 extern int avr_simplify_comparison_p (machine_mode mode,
index df4cbf343b4d609258bf0d16dcefd015638faced..62ddc579d861a33ebae83336b448db3fb205338f 100644 (file)
@@ -12149,14 +12149,12 @@ jump_over_one_insn_p (rtx_insn *insn, rtx dest)
 }
 
 
-/* Worker function for `HARD_REGNO_MODE_OK'.  */
-/* Returns 1 if a value of mode MODE can be stored starting with hard
-   register number REGNO.  On the enhanced core, anything larger than
-   1 byte must start in even numbered register for "movw" to work
-   (this way we don't have to check for odd registers everywhere).  */
+/* Implement TARGET_HARD_REGNO_MODE_OK.  On the enhanced core, anything
+   larger than 1 byte must start in even numbered register for "movw" to
+   work (this way we don't have to check for odd registers everywhere).  */
 
-int
-avr_hard_regno_mode_ok (int regno, machine_mode mode)
+static bool
+avr_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   /* NOTE: 8-bit values must not be disallowed for R28 or R29.
         Disallowing QI et al. in these regs might lead to code like
@@ -12169,7 +12167,7 @@ avr_hard_regno_mode_ok (int regno, machine_mode mode)
   /* Any GENERAL_REGS register can hold 8-bit values.  */
 
   if (GET_MODE_SIZE (mode) == 1)
-    return 1;
+    return true;
 
   /* FIXME: Ideally, the following test is not needed.
         However, it turned out that it can reduce the number
@@ -12178,7 +12176,7 @@ avr_hard_regno_mode_ok (int regno, machine_mode mode)
 
   if (GET_MODE_SIZE (mode) >= 4
       && regno >= REG_X)
-    return 0;
+    return false;
 
   /* All modes larger than 8 bits should start in an even register.  */
 
@@ -14691,6 +14689,8 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg,
 #undef TARGET_CONDITIONAL_REGISTER_USAGE
 #define TARGET_CONDITIONAL_REGISTER_USAGE avr_conditional_register_usage
 
+#undef  TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK avr_hard_regno_mode_ok
 #undef  TARGET_HARD_REGNO_SCRATCH_OK
 #define TARGET_HARD_REGNO_SCRATCH_OK avr_hard_regno_scratch_ok
 #undef  TARGET_HARD_REGNO_CALL_PART_CLOBBERED
index 212ca695ad50efcd891cbb5c8045935f0d38862b..449382c771c8bd7c41e4c8af58405f7116c9bc63 100644 (file)
@@ -212,8 +212,6 @@ FIXME: DRIVER_SELF_SPECS has changed.
 #define HARD_REGNO_NREGS(REGNO, MODE)                                   \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE) avr_hard_regno_mode_ok(REGNO, MODE)
-
 #define MODES_TIEABLE_P(MODE1, MODE2) 1
 
 enum reg_class {
index adca6fa60fab53daa3e43e00fd64bb4bb5356fff..223646d59a0a1ea0ffb5c56235c4061c930005e9 100644 (file)
@@ -71,7 +71,6 @@ extern char *bfin_asm_long (void);
 extern char *bfin_asm_short (void);
 extern int log2constp (unsigned HOST_WIDE_INT);
 
-extern int hard_regno_mode_ok (int, machine_mode);
 extern void init_cumulative_args (CUMULATIVE_ARGS *, tree, rtx);         
 extern HOST_WIDE_INT bfin_initial_elimination_offset (int, int);
 
index f04fe8747777dab061820b922284b267fa3c7368..7572527a1e5debd605185cf12d7a3c53e7ca5228 100644 (file)
@@ -2114,16 +2114,18 @@ bfin_expand_call (rtx retval, rtx fnaddr, rtx callarg1, rtx cookie, int sibcall)
     CALL_INSN_FUNCTION_USAGE (call) = use;
 }
 \f
-/* Return 1 if hard register REGNO can hold a value of machine-mode MODE.  */
+/* Implement TARGET_HARD_REGNO_MODE_OK.
 
-int
-hard_regno_mode_ok (int regno, machine_mode mode)
+   Do not allow to store a value in REG_CC for any mode.
+   Do not allow to store value in pregs if mode is not SI.  */
+static bool
+bfin_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   /* Allow only dregs to store value of mode HI or QI */
   enum reg_class rclass = REGNO_REG_CLASS (regno);
 
   if (mode == CCmode)
-    return 0;
+    return false;
 
   if (mode == V2HImode)
     return D_REGNO_P (regno);
@@ -2139,7 +2141,7 @@ hard_regno_mode_ok (int regno, machine_mode mode)
 
   if (mode == SImode
       && TEST_HARD_REG_BIT (reg_class_contents[PROLOGUE_REGS], regno))
-    return 1;
+    return true;
 
   return TEST_HARD_REG_BIT (reg_class_contents[MOST_REGS], regno);
 }
@@ -5845,4 +5847,7 @@ bfin_conditional_register_usage (void)
 #undef TARGET_CAN_USE_DOLOOP_P
 #define TARGET_CAN_USE_DOLOOP_P bfin_can_use_doloop_p
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK bfin_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
index 31ea70bc598cf87d3d551f5897e3bb8595c3f237..232ce23fe0df6ca2e7a0f264ff0d0da9887a991a 100644 (file)
@@ -677,10 +677,6 @@ enum reg_class
    registers.  */
 #define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P hook_bool_mode_true
 
-/* Do not allow to store a value in REG_CC for any mode */
-/* Do not allow to store value in pregs if mode is not SI*/
-#define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok((REGNO), (MODE))
-
 /* Return the maximum number of consecutive registers
    needed to represent mode MODE in a register of class CLASS.  */
 #define CLASS_MAX_NREGS(CLASS, MODE)                                   \
@@ -700,9 +696,9 @@ enum reg_class
    register allocation so as to avoid move instructions between a
    value of mode MODE1 and a value of mode MODE2.
 
-   If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
-   MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
-   MODE2)' must be zero. */
+   If `TARGET_HARD_REGNO_MODE_OK (R, MODE1)' and
+   `TARGET_HARD_REGNO_MODE_OK (R, MODE2)' are ever different for any R,
+   then `MODES_TIEABLE_P (MODE1, MODE2)' must be zero. */
 #define MODES_TIEABLE_P(MODE1, MODE2)                  \
  ((MODE1) == (MODE2)                                   \
   || ((GET_MODE_CLASS (MODE1) == MODE_INT              \
index 0bc21cc2ddccdb1c1986ba15b0baf13c1e62623b..7541c75ed9d2737038716f5e1b7bc6d12a15c06c 100644 (file)
@@ -79,7 +79,7 @@
   if (GET_CODE (op) == SUBREG)
     op = SUBREG_REG (op);
   if (REGNO (op) < FIRST_PSEUDO_REGISTER)
-    return HARD_REGNO_MODE_OK (REGNO (op), mode);
+    return targetm.hard_regno_mode_ok (REGNO (op), mode);
   return 1;
 })
 
index 4671f3c3cce0b9a0784269a3b2e2e1975a923797..af0dae2d0fa6ab6b9d813a035c75df04635bd287 100644 (file)
@@ -6696,6 +6696,14 @@ c6x_debug_unwind_info (void)
 
   return default_debug_unwind_info ();
 }
+
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+c6x_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return GET_MODE_SIZE (mode) <= UNITS_PER_WORD || (regno & 1) == 0;
+}
 \f
 /* Target Structure.  */
 
@@ -6862,6 +6870,9 @@ c6x_debug_unwind_info (void)
 #undef  TARGET_BUILTIN_DECL
 #define TARGET_BUILTIN_DECL c6x_builtin_decl
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK c6x_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-c6x.h"
index 3fe807238fe7bf64db3c47a31eff73af7355278d..da58fda17cfb32249e941ed938a6420756fadccf 100644 (file)
@@ -185,9 +185,6 @@ extern c6x_cpu_t c6x_arch;
   ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1)  \
    / UNITS_PER_WORD)
 
-#define HARD_REGNO_MODE_OK(reg, mode) (GET_MODE_SIZE (mode) <= UNITS_PER_WORD \
-                                      ? 1 : ((reg) & 1) == 0)
-
 #define MODES_TIEABLE_P(mode1, mode2)         \
   ((mode1) == (mode2) ||                      \
    (GET_MODE_SIZE (mode1) <= UNITS_PER_WORD && \
index 500de8244d6bafeeedcfcddbeebf03b9287ecf88..4872c0b8b2e3c97f050ab99b3e3661da54da2b68 100644 (file)
@@ -23,7 +23,6 @@
 
 /* Register usage.  */
 extern enum reg_class cr16_regno_reg_class (int);
-extern int cr16_hard_regno_mode_ok (int regno, machine_mode);
 
 /* Passing function arguments.  */
 extern int cr16_function_arg_regno_p (int);
index 729eec80c9175b0245a2525383d2035c51f9209b..39c3ba97640383ab292315ca136694ba9324ffd6 100644 (file)
@@ -220,6 +220,9 @@ static const struct attribute_spec cr16_attribute_table[] = {
 #undef TARGET_ASM_UNALIGNED_DI_OP
 #define TARGET_ASM_UNALIGNED_DI_OP     TARGET_ASM_ALIGNED_DI_OP
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK      cr16_hard_regno_mode_ok
+
 /* Target hook implementations.  */
 
 /* Implements hook TARGET_RETURN_IN_MEMORY.  */
@@ -463,28 +466,31 @@ cr16_regno_reg_class (int regno)
   return NO_REGS;
 }
 
-/* Return 1 if hard register REGNO can hold a value of machine-mode MODE.  */
-int
-cr16_hard_regno_mode_ok (int regno, machine_mode mode)
+/* Implement TARGET_HARD_REGNO_MODE_OK.  On the CR16 architecture, all
+   registers can hold all modes, except that double precision floats
+   (and double ints) must fall on even-register boundaries.  */
+
+static bool
+cr16_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   if ((GET_MODE_SIZE (mode) >= 4) && (regno == 11))
-    return 0;
+    return false;
  
   if (mode == DImode || mode == DFmode)
     {
       if ((regno > 8) || (regno & 1))
-       return 0;
-      return 1;
+       return false;
+      return true;
     }
 
   if ((TARGET_INT32)
        && ((regno >= 12) && (GET_MODE_SIZE (mode) < 4 )))
-     return 0;
+     return false;
 
   /* CC can only hold CCmode values.  */
   if (GET_MODE_CLASS (mode) == MODE_CC)
-    return 0;
-  return 1;
+    return false;
+  return true;
 }
 
 /* Returns register number for function return value.*/
index eba92544aa38d1733d5d755405a0d0da42a4f8c1..fc234e7e8e617bae0c109d673e3d5bce6821d038 100644 (file)
@@ -204,13 +204,6 @@ while (0)
   ? ((GET_MODE_SIZE (MODE) + CR16_UNITS_PER_DWORD - 1) / CR16_UNITS_PER_DWORD)\
   : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD       - 1) / UNITS_PER_WORD))
 
-/* Nonzero if it is permissible to store a value of mode @var{mode} in hard
-   register number @var{regno} (or in several registers starting with that
-   one).  On the CR16 architecture, all registers can hold all modes,
-   except that double precision floats (and double ints) must fall on
-   even-register boundaries.  */ 
-#define HARD_REGNO_MODE_OK(REGNO, MODE) cr16_hard_regno_mode_ok (REGNO, MODE)
-
 #define NOTICE_UPDATE_CC(EXP, INSN) \
    notice_update_cc ((EXP))
 
index b57881ac04e8d0a291fbe6b0be3afbded3d75a34..01806389075a17d770ef24cefbf798527dab6028 100644 (file)
@@ -163,6 +163,7 @@ static rtx cris_function_value(const_tree, const_tree, bool);
 static rtx cris_libcall_value (machine_mode, const_rtx);
 static bool cris_function_value_regno_p (const unsigned int);
 static void cris_file_end (void);
+static bool cris_hard_regno_mode_ok (unsigned int, machine_mode);
 
 /* This is the parsed result of the "-max-stack-stackframe=" option.  If
    it (still) is zero, then there was no such option given.  */
@@ -280,6 +281,9 @@ int cris_cpu_version = CRIS_DEFAULT_CPU_VERSION;
 #undef TARGET_FUNCTION_VALUE_REGNO_P
 #define TARGET_FUNCTION_VALUE_REGNO_P cris_function_value_regno_p
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK cris_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Helper for cris_load_multiple_op and cris_ret_movem_op.  */
@@ -4292,6 +4296,18 @@ cris_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
      sake of a trampoline.  */
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.
+
+   CRIS permits all registers to hold all modes.  Well, except for the
+   condition-code register.  And we can't hold larger-than-register size
+   modes in the last special register that can hold a full 32 bits.  */
+static bool
+cris_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return ((mode == CCmode || regno != CRIS_CC0_REGNUM)
+         && (GET_MODE_SIZE (mode) <= UNITS_PER_WORD
+             || (regno != CRIS_MOF_REGNUM && regno != CRIS_ACR_REGNUM)));
+}
 
 #if 0
 /* Various small functions to replace macros.  Only called from a
index 953f720a4322cb36fe23e5d274a82239d58e3992..8203b886f8b7d590e46bb09be39815156d7af88d 100644 (file)
@@ -477,18 +477,9 @@ extern int cris_cpu_version;
  (MODE == VOIDmode \
   ? 1 : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
 
-/* CRIS permits all registers to hold all modes.  Well, except for the
-   condition-code register.  And we can't hold larger-than-register size
-   modes in the last special register that can hold a full 32 bits.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                \
- (((MODE) == CCmode                            \
-   || (REGNO) != CRIS_CC0_REGNUM)              \
-  && (GET_MODE_SIZE (MODE) <= UNITS_PER_WORD   \
-      || ((REGNO) != CRIS_MOF_REGNUM && (REGNO) != CRIS_ACR_REGNUM)))
-
 /* Because CCmode isn't covered by the "narrower mode" statement in
    tm.texi, we can still say all modes are tieable despite not having an
-   always 1 HARD_REGNO_MODE_OK.  */
+   always 1 TARGET_HARD_REGNO_MODE_OK.  */
 #define MODES_TIEABLE_P(MODE1, MODE2) 1
 
 
index a586e7cdd0a35fb5f4fd20a364ab18a91adad065..841c25c6d40f86030c27ce1cf9e283b4bcbf4934 100644 (file)
@@ -38,7 +38,6 @@ extern void epiphany_expand_prologue (void);
 extern void epiphany_expand_epilogue (int);
 extern int epiphany_initial_elimination_offset (int, int);
 extern void epiphany_init_expanders (void);
-extern int hard_regno_mode_ok (int regno, machine_mode mode);
 #ifdef HARD_CONST
 extern void emit_set_fp_mode (int entity, int mode, int prev_mode,
                              HARD_REG_SET regs_live);
index d5d88d38f406a081a46c9d45c9f0b725f078ac79..67d52b8e891832e3e5177d9757d568fe37be05c2 100644 (file)
@@ -170,6 +170,9 @@ static rtx_insn *frame_insn (rtx);
 #define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
 #undef TARGET_ASM_ALIGNED_SI_OP
 #define TARGET_ASM_ALIGNED_SI_OP "\t.word\t"
+
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK epiphany_hard_regno_mode_ok
 \f
 bool
 epiphany_is_interrupt_p (tree decl)
@@ -355,14 +358,15 @@ get_epiphany_condition_code (rtx comparison)
 }
 
 
-/* Return 1 if hard register REGNO can hold a value of machine_mode MODE.  */
-int
-hard_regno_mode_ok (int regno, machine_mode mode)
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+epiphany_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   if (GET_MODE_SIZE (mode) > UNITS_PER_WORD)
     return (regno & 1) == 0 && GPR_P (regno);
   else
-    return 1;
+    return true;
 }
 
 /* Given a comparison code (EQ, NE, etc.) and the first operand of a COMPARE,
index c06726c4900eb115908b13aac851b2ff99fa8ce1..416899196a54c43f43c8dff1be14e9392beaa8fd 100644 (file)
@@ -309,18 +309,13 @@ along with GCC; see the file COPYING3.  If not see
 #define HARD_REGNO_NREGS(REGNO, MODE) \
 ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.  */
-extern const unsigned int epiphany_hard_regno_mode_ok[];
-extern unsigned int epiphany_mode_class[];
-#define HARD_REGNO_MODE_OK(REGNO, MODE) hard_regno_mode_ok((REGNO), (MODE))
-
 /* A C expression that is nonzero if it is desirable to choose
    register allocation so as to avoid move instructions between a
    value of mode MODE1 and a value of mode MODE2.
 
-   If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
-   MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
-   MODE2)' must be zero.  */
+   If `TARGET_HARD_REGNO_MODE_OK (R, MODE1)' and
+   `TARGET_HARD_REGNO_MODE_OK (R, MODE2)' are ever different for any R,
+   then `MODES_TIEABLE_P (MODE1, MODE2)' must be zero.  */
 
 #define MODES_TIEABLE_P(MODE1, MODE2) 1
 
index f701195aba5766507e3c72f9bdba9cfda5ac294a..0366fdd05f8713fdb5c516489ce603dec2ed307e 100644 (file)
@@ -246,19 +246,13 @@ along with GCC; see the file COPYING3.  If not see
 #define HARD_REGNO_NREGS(REGNO, MODE)                  \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* A C expression that is nonzero if it is permissible to store a value of mode
-   MODE in hard register number REGNO (or in several registers starting with
-   that one).  */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
 /* A C expression that is nonzero if it is desirable to choose register
    allocation so as to avoid move instructions between a value of mode MODE1
    and a value of mode MODE2.
 
-   If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, MODE2)' are
-   ever different for any R, then `MODES_TIEABLE_P (MODE1, MODE2)' must be
-   zero.  */
+   If `TARGET_HARD_REGNO_MODE_OK (R, MODE1)' and
+   `TARGET_HARD_REGNO_MODE_OK (R, MODE2)' are ever different for any R,
+   then `MODES_TIEABLE_P (MODE1, MODE2)' must be zero.  */
 #define MODES_TIEABLE_P(MODE1, MODE2) 1
 
 /*}}}*/ \f
index ec6eb4f0f2c5636003826af6ab2d8bd0cae4ee88..383a7ee74e52e2a543093b073fb7919bbd77c2d2 100644 (file)
 ;; patterns `reload_inM' or `reload_outM' to handle them.
 
 ;; The constraints on a `moveM' must permit moving any hard register to any
-;; other hard register provided that `HARD_REGNO_MODE_OK' permits mode M in
-;; both registers and `REGISTER_MOVE_COST' applied to their classes returns a
-;; value of 2.
+;; other hard register provided that `TARGET_HARD_REGNO_MODE_OK' permits mode
+;; M in both registers and `REGISTER_MOVE_COST' applied to their classes
+;; returns a value of 2.
 
 ;; It is obligatory to support floating point `moveM' instructions
 ;; into and out of any registers that can hold fixed point values,
 ;; `DImode') can be in those registers and they may have floating
 ;; point members.
 
-;; There may also be a need to support fixed point `moveM' instructions in and
-;; out of floating point registers.  Unfortunately, I have forgotten why this
-;; was so, and I don't know whether it is still true.  If `HARD_REGNO_MODE_OK'
-;; rejects fixed point values in floating point registers, then the constraints
-;; of the fixed point `moveM' instructions must be designed to avoid ever
-;; trying to reload into a floating point register.
+;; There may also be a need to support fixed point `moveM' instructions
+;; in and out of floating point registers.  Unfortunately, I have
+;; forgotten why this was so, and I don't know whether it is still true.
+;; If `TARGET_HARD_REGNO_MODE_OK' rejects fixed point values in floating
+;; point registers, then the constraints of the fixed point `moveM'
+;; instructions must be designed to avoid ever trying to reload into a
+;; floating point register.
 
 ;;}}}
 ;;{{{ Push and Pop  
index aeead104fe51e024065c73d4722d31bf5d2819ca..be87f74c46a16a8de479b296757637c67c972a22 100644 (file)
@@ -74,7 +74,6 @@ extern void frv_ifcvt_modify_cancel   (struct ce_if_block *);
 extern enum reg_class frv_secondary_reload_class
                                        (enum reg_class,
                                         machine_mode, rtx);
-extern int frv_hard_regno_mode_ok      (int, machine_mode);
 extern int frv_hard_regno_nregs                (int, machine_mode);
 extern int frv_class_max_nregs         (enum reg_class rclass,
                                         machine_mode mode);
index 4e589cfc501abdd534b1fab381b992fc1009a45e..3c40d9b2ef90152154ba5c12412209b9ebb63578 100644 (file)
@@ -399,6 +399,7 @@ static bool frv_can_eliminate                       (const int, const int);
 static void frv_conditional_register_usage     (void);
 static void frv_trampoline_init                        (rtx, tree, rtx);
 static bool frv_class_likely_spilled_p                 (reg_class_t);
+static bool frv_hard_regno_mode_ok             (unsigned int, machine_mode);
 \f
 /* Initialize the GCC target structure.  */
 #undef TARGET_PRINT_OPERAND
@@ -516,6 +517,9 @@ static bool frv_class_likely_spilled_p              (reg_class_t);
 #undef TARGET_LIBCALL_VALUE
 #define TARGET_LIBCALL_VALUE frv_libcall_value
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK frv_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #define FRV_SYMBOL_REF_TLS_P(RTX) \
@@ -6517,62 +6521,10 @@ frv_adjust_field_align (tree field, int computed)
 }
 
 \f
-/* A C expression that is nonzero if it is permissible to store a value of mode
-   MODE in hard register number REGNO (or in several registers starting with
-   that one).  For a machine where all registers are equivalent, a suitable
-   definition is
-
-        #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
-   It is not necessary for this macro to check for the numbers of fixed
-   registers, because the allocation mechanism considers them to be always
-   occupied.
-
-   On some machines, double-precision values must be kept in even/odd register
-   pairs.  The way to implement that is to define this macro to reject odd
-   register numbers for such modes.
-
-   The minimum requirement for a mode to be OK in a register is that the
-   `movMODE' instruction pattern support moves between the register and any
-   other hard register for which the mode is OK; and that moving a value into
-   the register and back out not alter it.
-
-   Since the same instruction used to move `SImode' will work for all narrower
-   integer modes, it is not necessary on any machine for `HARD_REGNO_MODE_OK'
-   to distinguish between these modes, provided you define patterns `movhi',
-   etc., to take advantage of this.  This is useful because of the interaction
-   between `HARD_REGNO_MODE_OK' and `MODES_TIEABLE_P'; it is very desirable for
-   all integer modes to be tieable.
-
-   Many machines have special registers for floating point arithmetic.  Often
-   people assume that floating point machine modes are allowed only in floating
-   point registers.  This is not true.  Any registers that can hold integers
-   can safely *hold* a floating point machine mode, whether or not floating
-   arithmetic can be done on it in those registers.  Integer move instructions
-   can be used to move the values.
-
-   On some machines, though, the converse is true: fixed-point machine modes
-   may not go in floating registers.  This is true if the floating registers
-   normalize any value stored in them, because storing a non-floating value
-   there would garble it.  In this case, `HARD_REGNO_MODE_OK' should reject
-   fixed-point machine modes in floating registers.  But if the floating
-   registers do not automatically normalize, if you can store any bit pattern
-   in one and retrieve it unchanged without a trap, then any machine mode may
-   go in a floating register, so you can define this macro to say so.
-
-   The primary significance of special floating registers is rather that they
-   are the registers acceptable in floating point arithmetic instructions.
-   However, this is of no concern to `HARD_REGNO_MODE_OK'.  You handle it by
-   writing the proper constraints for those instructions.
-
-   On some machines, the floating registers are especially slow to access, so
-   that it is better to store a value in a stack frame than in such a register
-   if floating point arithmetic is not being done.  As long as the floating
-   registers are not in class `GENERAL_REGS', they will not be used unless some
-   pattern's constraint asks for one.  */
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
 
-int
-frv_hard_regno_mode_ok (int regno, machine_mode mode)
+static bool
+frv_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   int base;
   int mask;
@@ -6624,18 +6576,18 @@ frv_hard_regno_mode_ok (int regno, machine_mode mode)
 
          /* Fill in the table.  */
          else
-           return 0;
+           return false;
 
          /* Anything smaller than an SI is OK in any word-sized register.  */
          if (GET_MODE_SIZE (mode) < 4)
-           return 1;
+           return true;
 
          mask = (GET_MODE_SIZE (mode) / 4) - 1;
        }
       return (((regno - base) & mask) == 0);
     }
 
-  return 0;
+  return false;
 }
 
 \f
index 4acaabb1a06948a0c1e606011dd119a8a1482a0f..2e2957c0f36aeec2f2d0de21ca01df64fd1db992 100644 (file)
    we can build the appropriate instructions to properly reload the values.  */
 #define HARD_REGNO_NREGS(REGNO, MODE) frv_hard_regno_nregs (REGNO, MODE)
 
-/* A C expression that is nonzero if it is permissible to store a value of mode
-   MODE in hard register number REGNO (or in several registers starting with
-   that one).  For a machine where all registers are equivalent, a suitable
-   definition is
-
-        #define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
-   It is not necessary for this macro to check for the numbers of fixed
-   registers, because the allocation mechanism considers them to be always
-   occupied.
-
-   On some machines, double-precision values must be kept in even/odd register
-   pairs.  The way to implement that is to define this macro to reject odd
-   register numbers for such modes.
-
-   The minimum requirement for a mode to be OK in a register is that the
-   `movMODE' instruction pattern support moves between the register and any
-   other hard register for which the mode is OK; and that moving a value into
-   the register and back out not alter it.
-
-   Since the same instruction used to move `SImode' will work for all narrower
-   integer modes, it is not necessary on any machine for `HARD_REGNO_MODE_OK'
-   to distinguish between these modes, provided you define patterns `movhi',
-   etc., to take advantage of this.  This is useful because of the interaction
-   between `HARD_REGNO_MODE_OK' and `MODES_TIEABLE_P'; it is very desirable for
-   all integer modes to be tieable.
-
-   Many machines have special registers for floating point arithmetic.  Often
-   people assume that floating point machine modes are allowed only in floating
-   point registers.  This is not true.  Any registers that can hold integers
-   can safely *hold* a floating point machine mode, whether or not floating
-   arithmetic can be done on it in those registers.  Integer move instructions
-   can be used to move the values.
-
-   On some machines, though, the converse is true: fixed-point machine modes
-   may not go in floating registers.  This is true if the floating registers
-   normalize any value stored in them, because storing a non-floating value
-   there would garble it.  In this case, `HARD_REGNO_MODE_OK' should reject
-   fixed-point machine modes in floating registers.  But if the floating
-   registers do not automatically normalize, if you can store any bit pattern
-   in one and retrieve it unchanged without a trap, then any machine mode may
-   go in a floating register, so you can define this macro to say so.
-
-   The primary significance of special floating registers is rather that they
-   are the registers acceptable in floating point arithmetic instructions.
-   However, this is of no concern to `HARD_REGNO_MODE_OK'.  You handle it by
-   writing the proper constraints for those instructions.
-
-   On some machines, the floating registers are especially slow to access, so
-   that it is better to store a value in a stack frame than in such a register
-   if floating point arithmetic is not being done.  As long as the floating
-   registers are not in class `GENERAL_REGS', they will not be used unless some
-   pattern's constraint asks for one.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) frv_hard_regno_mode_ok (REGNO, MODE)
-
 /* A C expression that is nonzero if it is desirable to choose register
    allocation so as to avoid move instructions between a value of mode MODE1
    and a value of mode MODE2.
 
-   If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, MODE2)' are
-   ever different for any R, then `MODES_TIEABLE_P (MODE1, MODE2)' must be
-   zero.  */
+   If `TARGET_HARD_REGNO_MODE_OK (R, MODE1)' and
+   `TARGET_HARD_REGNO_MODE_OK (R, MODE2)' are ever different for any R,
+   then `MODES_TIEABLE_P (MODE1, MODE2)' must be zero.  */
 #define MODES_TIEABLE_P(MODE1, MODE2) (MODE1 == MODE2)
 
 /* Define this macro if the compiler should avoid copies to/from CCmode
index 4cfc489d14ad0c61b237512b738549c8ebe15b5d..6411c68b2eb1a9aef39f289f57e0fc2f1ab10ad3 100644 (file)
 ;; patterns `reload_inM' or `reload_outM' to handle them.
 
 ;; The constraints on a `moveM' must permit moving any hard register to any
-;; other hard register provided that `HARD_REGNO_MODE_OK' permits mode M in
-;; both registers and `REGISTER_MOVE_COST' applied to their classes returns a
-;; value of 2.
+;; other hard register provided that `TARGET_HARD_REGNO_MODE_OK' permits
+;; mode M in both registers and `REGISTER_MOVE_COST' applied to their
+;; classes returns a value of 2.
 
 ;; It is obligatory to support floating point `moveM' instructions
 ;; into and out of any registers that can hold fixed point values,
 ;; `DImode') can be in those registers and they may have floating
 ;; point members.
 
-;; There may also be a need to support fixed point `moveM' instructions in and
-;; out of floating point registers.  Unfortunately, I have forgotten why this
-;; was so, and I don't know whether it is still true.  If `HARD_REGNO_MODE_OK'
-;; rejects fixed point values in floating point registers, then the constraints
-;; of the fixed point `moveM' instructions must be designed to avoid ever
-;; trying to reload into a floating point register.
+;; There may also be a need to support fixed point `moveM' instructions
+;; in and out of floating point registers.  Unfortunately, I have
+;; forgotten why this was so, and I don't know whether it is still true.
+;; If `TARGET_HARD_REGNO_MODE_OK' rejects fixed point values in floating
+;; point registers, then the constraints of the fixed point `moveM'
+;; instructions must be designed to avoid ever trying to reload into a
+;; floating point register.
 
 (define_expand "movqi"
   [(set (match_operand:QI 0 "general_operand" "")
index 11e25e36c0e6028f92b99f6125511e631c8ead38..84de381d152395cb3e312e41654c6b786e08162b 100644 (file)
@@ -166,12 +166,6 @@ enum reg_class
 /* We can't copy to or from our CC register. */
 #define AVOID_CCMODE_COPIES 1
 
-/* A C expression that is nonzero if it is permissible to store a
-   value of mode MODE in hard register number REGNO (or in several
-   registers starting with that one).  All gstore registers are
-   equivalent, so we can set this to 1.  */
-#define HARD_REGNO_MODE_OK(R,M) 1
-
 /* A C expression whose value is a register class containing hard
    register REGNO.  */
 #define REGNO_REG_CLASS(R) ((R < FT32_PC) ? GENERAL_REGS :                \
index 225c0254130cf248f4c02b388cf52ea24387266a..16829a04d06adf1cd7b2003e781fd91db3744fcd 100644 (file)
@@ -100,7 +100,6 @@ extern int h8300_initial_elimination_offset (int, int);
 extern int h8300_regs_ok_for_stm (int, rtx[]);
 extern int h8300_hard_regno_rename_ok (unsigned int, unsigned int);
 extern int h8300_hard_regno_nregs (int, machine_mode);
-extern int h8300_hard_regno_mode_ok (int, machine_mode);
 extern bool h8300_move_ok (rtx, rtx);
 
 struct cpp_reader;
index 4ca58b20b05dc48a6c7ea650f2a7dccbbe110c86..a8b1cf2025a017a84675e29cabe8da5d0c1890fd 100644 (file)
@@ -5889,10 +5889,10 @@ h8300_hard_regno_nregs (int regno ATTRIBUTE_UNUSED, machine_mode mode)
   return (GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD;
 }
 
-/* Worker function for HARD_REGNO_MODE_OK.  */
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
 
-int
-h8300_hard_regno_mode_ok (int regno, machine_mode mode)
+static bool
+h8300_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   if (TARGET_H8300)
     /* If an even reg, then anything goes.  Otherwise the mode must be
@@ -6101,6 +6101,9 @@ h8300_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt)
 #undef TARGET_HARD_REGNO_SCRATCH_OK
 #define TARGET_HARD_REGNO_SCRATCH_OK h8300_hard_regno_scratch_ok
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK h8300_hard_regno_mode_ok
+
 #undef TARGET_LRA_P
 #define TARGET_LRA_P hook_bool_void_false
 
index 9ab92a4e0a6e847b8eb28de6aa0ff2743e8ba96a..6a72e8704c8d6d63d6eb4419708f61ebeb33d112 100644 (file)
@@ -239,13 +239,10 @@ extern const char * const *h8_reg_names;
 #define HARD_REGNO_NREGS(REGNO, MODE)          \
   h8300_hard_regno_nregs ((REGNO), (MODE))
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                \
-  h8300_hard_regno_mode_ok ((REGNO), (MODE))
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.  */
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.  */
 #define MODES_TIEABLE_P(MODE1, MODE2)                                    \
   ((MODE1) == (MODE2)                                                    \
    || (((MODE1) == QImode || (MODE1) == HImode                           \
index 2c15ba8505cc1badd723324b35ff1e0f0c1db66d..7ab149f0299084cfb5f81e2b86d1ae0a23e05469 100644 (file)
@@ -167,7 +167,6 @@ extern int ix86_reg_parm_stack_space (const_tree);
 
 extern void ix86_split_fp_branch (enum rtx_code code, rtx, rtx,
                                  rtx, rtx, rtx);
-extern bool ix86_hard_regno_mode_ok (int, machine_mode);
 extern bool ix86_modes_tieable_p (machine_mode, machine_mode);
 extern bool ix86_secondary_memory_needed (enum reg_class, enum reg_class,
                                          machine_mode, int);
index 6c1057fba598900680a5257453540c2e6d53592b..fd5f813a27c8f6d922ae50e3100c529c1d028d6b 100644 (file)
@@ -41296,11 +41296,10 @@ ix86_register_move_cost (machine_mode mode, reg_class_t class1_i,
   return 2;
 }
 
-/* Return TRUE if hard register REGNO can hold a value of machine-mode
-   MODE.  */
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
 
-bool
-ix86_hard_regno_mode_ok (int regno, machine_mode mode)
+static bool
+ix86_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   /* Flags and only flags can only hold CCmode values.  */
   if (CC_REGNO_P (regno))
@@ -53261,6 +53260,9 @@ ix86_run_selftests (void)
 #undef TARGET_NOCE_CONVERSION_PROFITABLE_P
 #define TARGET_NOCE_CONVERSION_PROFITABLE_P ix86_noce_conversion_profitable_p
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK ix86_hard_regno_mode_ok
+
 #undef TARGET_HARD_REGNO_CALL_PART_CLOBBERED
 #define TARGET_HARD_REGNO_CALL_PART_CLOBBERED \
   ix86_hard_regno_call_part_clobbered
index 05dabf273e228569e01b9041a25aa098b8c6eb5d..d3dbeded72bfb6310f4fd2a5600dc0b6ea206d29 100644 (file)
@@ -1181,15 +1181,10 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
   (TARGET_FMA4 && ((MODE) == V4SFmode || (MODE) == V2DFmode \
                  || (MODE) == V8SFmode || (MODE) == V4DFmode))
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.  */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE)        \
-   ix86_hard_regno_mode_ok ((REGNO), (MODE))
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.  */
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.  */
 
 #define MODES_TIEABLE_P(MODE1, MODE2) \
   ix86_modes_tieable_p ((MODE1), (MODE2))
index 1326877b26a18e6bab90c887f19bf8640d04d511..583614f1709825da0ca3c93677de89744281b4d1 100644 (file)
@@ -335,6 +335,8 @@ static section * ia64_hpux_function_section (tree, enum node_frequency,
 static bool ia64_vectorize_vec_perm_const_ok (machine_mode vmode,
                                              const unsigned char *sel);
 
+static bool ia64_hard_regno_mode_ok (unsigned int, machine_mode);
+
 #define MAX_VECT_LEN   8
 
 struct expand_vec_perm_d
@@ -653,6 +655,9 @@ static const struct attribute_spec ia64_attribute_table[] =
 #undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS
 #define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 0
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK ia64_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Returns TRUE iff the target attribute indicated by ATTR_ID takes a plain
@@ -4251,6 +4256,31 @@ ia64_hard_regno_rename_ok (int from, int to)
   return 1;
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+ia64_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  if (FR_REGNO_P (regno))
+    return (GET_MODE_CLASS (mode) != MODE_CC
+           && mode != BImode
+           && mode != TFmode);
+
+  if (PR_REGNO_P (regno))
+    return mode == BImode || GET_MODE_CLASS (mode) == MODE_CC;
+
+  if (GR_REGNO_P (regno))
+    return mode != XFmode && mode != XCmode && mode != RFmode;
+
+  if (AR_REGNO_P (regno))
+    return mode == DImode;
+
+  if (BR_REGNO_P (regno))
+    return mode == DImode;
+
+  return false;
+}
+
 /* Target hook for assembling integer objects.  Handle word-sized
    aligned objects and detect the cases when @fptr is needed.  */
 
index 8e68a740e3198fb15f2dca091a24fa81fe0699f0..4567cf661e5c2df0fb8be3ab6004271d3e6a150b 100644 (file)
@@ -614,30 +614,13 @@ while (0)
    : FR_REGNO_P (REGNO) && (MODE) == XCmode ? 2                                \
    : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* A C expression that is nonzero if it is permissible to store a value of mode
-   MODE in hard register number REGNO (or in several registers starting with
-   that one).  */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                                \
-  (FR_REGNO_P (REGNO) ?                                                \
-     GET_MODE_CLASS (MODE) != MODE_CC &&                       \
-     (MODE) != BImode &&                                       \
-     (MODE) != TFmode                                          \
-   : PR_REGNO_P (REGNO) ?                                      \
-     (MODE) == BImode || GET_MODE_CLASS (MODE) == MODE_CC      \
-   : GR_REGNO_P (REGNO) ?                                      \
-     (MODE) != XFmode && (MODE) != XCmode && (MODE) != RFmode  \
-   : AR_REGNO_P (REGNO) ? (MODE) == DImode                     \
-   : BR_REGNO_P (REGNO) ? (MODE) == DImode                     \
-   : 0)
-
 /* A C expression that is nonzero if it is desirable to choose register
    allocation so as to avoid move instructions between a value of mode MODE1
    and a value of mode MODE2.
 
-   If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, MODE2)' are
-   ever different for any R, then `MODES_TIEABLE_P (MODE1, MODE2)' must be
-   zero.  */
+   If `TARGET_HARD_REGNO_MODE_OK (R, MODE1)' and
+   `TARGET_HARD_REGNO_MODE_OK (R, MODE2)' are ever different for any R,
+   then `MODES_TIEABLE_P (MODE1, MODE2)' must be zero.  */
 /* Don't tie integer and FP modes, as that causes us to get integer registers
    allocated for FP instructions.  XFmode only supported in FP registers so
    we can't tie it with any other modes.  */
index 3e010a9729abee7103ff7987a3098bdf6b26874a..b57f4184db6cf6f1ee745efe0e6588bb75d71dd9 100644 (file)
@@ -177,6 +177,7 @@ static rtx iq2000_libcall_value       (machine_mode, const_rtx);
 static void iq2000_print_operand      (FILE *, rtx, int);
 static void iq2000_print_operand_address (FILE *, machine_mode, rtx);
 static bool iq2000_print_operand_punct_valid_p (unsigned char code);
+static bool iq2000_hard_regno_mode_ok (unsigned int, machine_mode);
 
 #undef  TARGET_INIT_BUILTINS
 #define TARGET_INIT_BUILTINS           iq2000_init_builtins
@@ -254,6 +255,9 @@ static bool iq2000_print_operand_punct_valid_p (unsigned char code);
 #undef  TARGET_TRAMPOLINE_INIT
 #define TARGET_TRAMPOLINE_INIT         iq2000_trampoline_init
 
+#undef  TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK      iq2000_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Return nonzero if we split the address into high and low parts.  */
@@ -3485,4 +3489,14 @@ iq2000_trampoline_init (rtx m_tramp, tree fndecl, rtx chain_value)
   emit_move_insn (mem, chain_value);
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+iq2000_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return (REGNO_REG_CLASS (regno) == GR_REGS
+         ? (regno & 1) == 0 || GET_MODE_SIZE (mode) <= 4
+         : (regno & 1) == 0 || GET_MODE_SIZE (mode) == 4);
+}
+
 #include "gt-iq2000.h"
index 343ebe451956315a690d92c9ab1877eb8dc0d130..2c22cfbb366ae56b6fbc7f9d59f56ac61daacd5a 100644 (file)
 #define HARD_REGNO_NREGS(REGNO, MODE)   \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                        \
- ((REGNO_REG_CLASS (REGNO) == GR_REGS)                         \
-  ? ((REGNO) & 1) == 0 || GET_MODE_SIZE (MODE) <= 4            \
-  : ((REGNO) & 1) == 0 || GET_MODE_SIZE (MODE) == 4)
-
 #define MODES_TIEABLE_P(MODE1, MODE2)                          \
   ((GET_MODE_CLASS (MODE1) == MODE_FLOAT ||                    \
     GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT)              \
index 214cc0ac5fde6d18056188e40db23495c0acb217..536944fe2f7db4c95d98f8e3db05cf4896551025 100644 (file)
@@ -77,6 +77,7 @@ static rtx lm32_function_arg (cumulative_args_t cum,
 static void lm32_function_arg_advance (cumulative_args_t cum,
                                       machine_mode mode,
                                       const_tree type, bool named);
+static bool lm32_hard_regno_mode_ok (unsigned int, machine_mode);
 
 #undef TARGET_OPTION_OVERRIDE
 #define TARGET_OPTION_OVERRIDE lm32_option_override
@@ -106,6 +107,8 @@ static void lm32_function_arg_advance (cumulative_args_t cum,
 #define TARGET_LRA_P hook_bool_void_false
 #undef TARGET_LEGITIMATE_ADDRESS_P
 #define TARGET_LEGITIMATE_ADDRESS_P lm32_legitimate_address_p
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK lm32_hard_regno_mode_ok
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 
@@ -1221,3 +1224,11 @@ lm32_move_ok (machine_mode mode, rtx operands[2]) {
     return register_or_zero_operand (operands[1], mode);
   return true;
 }
+
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+lm32_hard_regno_mode_ok (unsigned int regno, machine_mode)
+{
+  return G_REG_P (regno);
+}
index 2e25a2e157b515eb8cc5e2389e69313f826529f9..c890db932c2f00905abf5dfdf42a713b836372ab 100644 (file)
@@ -166,8 +166,6 @@ do {                                                    \
 #define HARD_REGNO_NREGS(REGNO, MODE)                                   \
     ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE) G_REG_P(REGNO)
-
 #define MODES_TIEABLE_P(MODE1, MODE2)           \
 (      GET_MODE_CLASS (MODE1) == MODE_INT              \
     && GET_MODE_CLASS (MODE2) == MODE_INT              \
index 89b9270ba3c026bf578bfd928f73985958bab017..de03b51fa744957bbe23f34354df56b9d4fe7dd6 100644 (file)
@@ -50,7 +50,6 @@ void m32c_expand_neg_mulpsi3 (rtx *);
 int  m32c_expand_setmemhi (rtx *);
 bool m32c_matches_constraint_p (rtx, int);
 int  m32c_hard_regno_nregs (int, machine_mode);
-int  m32c_hard_regno_ok (int, machine_mode);
 bool m32c_illegal_subreg_p (rtx);
 bool m32c_immd_dbl_mov (rtx *, machine_mode);
 rtx  m32c_incoming_return_addr_rtx (void);
index 8552ae69a11bccb8661a971d3000399d2b62ae81..39d1fd8018ccc1e5e029b4ec5fb7872af01ca01c 100644 (file)
@@ -92,6 +92,8 @@ static rtx m32c_libcall_value (machine_mode, const_rtx);
 /* Returns true if an address is specified, else false.  */
 static bool m32c_get_pragma_address (const char *varname, unsigned *addr);
 
+static bool m32c_hard_regno_mode_ok (unsigned int, machine_mode);
+
 #define SYMBOL_FLAG_FUNCVEC_FUNCTION    (SYMBOL_FLAG_MACH_DEP << 0)
 
 #define streq(a,b) (strcmp ((a), (b)) == 0)
@@ -370,7 +372,7 @@ class_can_hold_mode (reg_class_t rclass, machine_mode mode)
       results[rclass][mode] = 1;
       for (r = 0; r < FIRST_PSEUDO_REGISTER; r++)
        if (in_hard_reg_set_p (reg_class_contents[(int) rclass], mode, r)
-           && HARD_REGNO_MODE_OK (r, mode))
+           && m32c_hard_regno_mode_ok (r, mode))
          {
            results[rclass][mode] = 2;
            break;
@@ -573,10 +575,10 @@ m32c_hard_regno_nregs (int regno, machine_mode mode)
   return rv ? rv : 1;
 }
 
-/* ImplementHARD_REGNO_MODE_OK.  The above function does the work
+/* Implement TARGET_HARD_REGNO_MODE_OK.  The above function does the work
    already; just test its return value.  */
-int
-m32c_hard_regno_ok (int regno, machine_mode mode)
+static bool
+m32c_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   return m32c_hard_regno_nregs_1 (regno, mode) != 0;
 }
@@ -815,7 +817,7 @@ m32c_cannot_change_mode_class (machine_mode from,
      can't allow the change.  */
   for (rn = 0; rn < FIRST_PSEUDO_REGISTER; rn++)
     if (class_contents[rclass][0] & (1 << rn))
-      if (! m32c_hard_regno_ok (rn, to))
+      if (! m32c_hard_regno_mode_ok (rn, to))
        return 1;
 
   if (to == QImode)
@@ -4487,6 +4489,9 @@ m32c_output_compare (rtx_insn *insn, rtx *operands)
 #undef TARGET_FRAME_POINTER_REQUIRED
 #define TARGET_FRAME_POINTER_REQUIRED hook_bool_void_true
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK m32c_hard_regno_mode_ok
+
 /* The Global `targetm' Variable. */
 
 struct gcc_target targetm = TARGET_INITIALIZER;
index 72a0807bb173eef682baf3dc551b2cfea16b2485..0561df320ee22fe65f8795b533e6593bc22ab464 100644 (file)
@@ -256,7 +256,6 @@ machine_function;
 /* How Values Fit in Registers */
 
 #define HARD_REGNO_NREGS(R,M) m32c_hard_regno_nregs (R, M)
-#define HARD_REGNO_MODE_OK(R,M) m32c_hard_regno_ok (R, M)
 #define MODES_TIEABLE_P(M1,M2) m32c_modes_tieable_p (M1, M2)
 #define AVOID_CCMODE_COPIES
 
index 56d1dbddb2d0f3b6f74328a3bfb73da3b59e0411..44736ed4b29fb24634db1d95615df2b37fb165c1 100644 (file)
@@ -102,6 +102,7 @@ static void m32r_conditional_register_usage (void);
 static void m32r_trampoline_init (rtx, tree, rtx);
 static bool m32r_legitimate_constant_p (machine_mode, rtx);
 static bool m32r_attribute_identifier (const_tree);
+static bool m32r_hard_regno_mode_ok (unsigned int, machine_mode);
 \f
 /* M32R specific attributes.  */
 
@@ -209,6 +210,9 @@ static const struct attribute_spec m32r_attribute_table[] =
 #undef TARGET_LEGITIMATE_CONSTANT_P
 #define TARGET_LEGITIMATE_CONSTANT_P m32r_legitimate_constant_p
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK m32r_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Called by m32r_option_override to initialize various things.  */
@@ -270,14 +274,14 @@ enum m32r_mode_class
 
 /* Value is 1 if register/mode pair is acceptable on arc.  */
 
-const unsigned int m32r_hard_regno_mode_ok[FIRST_PSEUDO_REGISTER] =
+static const unsigned int m32r_hard_regno_modes[FIRST_PSEUDO_REGISTER] =
 {
   T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, T_MODES,
   T_MODES, T_MODES, T_MODES, T_MODES, T_MODES, S_MODES, S_MODES, S_MODES,
   S_MODES, C_MODES, A_MODES, A_MODES
 };
 
-unsigned int m32r_mode_class [NUM_MACHINE_MODES];
+static unsigned int m32r_mode_class [NUM_MACHINE_MODES];
 
 enum reg_class m32r_regno_reg_class[FIRST_PSEUDO_REGISTER];
 
@@ -2747,6 +2751,14 @@ m32r_output_block_move (rtx insn ATTRIBUTE_UNUSED, rtx operands[])
     }
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+m32r_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return (m32r_hard_regno_modes[regno] & m32r_mode_class[mode]) != 0;
+}
+
 /* Return true if using NEW_REG in place of OLD_REG is ok.  */
 
 int
index 70e702f56e2640e3c0a2b5be7f1c7443b72d0a26..5f74f7f4a37c0fad1a2b08430fb6ef4c485f83be 100644 (file)
 #define HARD_REGNO_NREGS(REGNO, MODE) \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.  */
-extern const unsigned int m32r_hard_regno_mode_ok[FIRST_PSEUDO_REGISTER];
-extern unsigned int m32r_mode_class[];
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-  ((m32r_hard_regno_mode_ok[REGNO] & m32r_mode_class[MODE]) != 0)
-
 /* A C expression that is nonzero if it is desirable to choose
    register allocation so as to avoid move instructions between a
    value of mode MODE1 and a value of mode MODE2.
 
-   If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
-   MODE2)' are ever different for any R, then `MODES_TIEABLE_P (MODE1,
-   MODE2)' must be zero.  */
+   If `TARGET_HARD_REGNO_MODE_OK (R, MODE1)' and
+   `TARGET_HARD_REGNO_MODE_OK (R, MODE2)' are ever different for any R,
+   then `MODES_TIEABLE_P (MODE1, MODE2)' must be zero.  */
 
 /* Tie QI/HI/SI modes together.  */
 #define MODES_TIEABLE_P(MODE1, MODE2)          \
index 106518423a2c4375e3559864e35f972202c4ccac..cdd6798c6608d42b7e6bf15ad20dd0ea9ab52eab 100644 (file)
@@ -86,7 +86,6 @@ extern enum attr_op_mem m68k_sched_attr_op_mem (rtx_insn *);
 
 #endif /* RTX_CODE */
 
-extern bool m68k_regno_mode_ok (int, machine_mode);
 extern enum reg_class m68k_secondary_reload_class (enum reg_class,
                                                   machine_mode, rtx);
 extern enum reg_class m68k_preferred_reload_class (rtx, enum reg_class);
index 08c7292a42cac43cca471ef6cd4cbb0ea3afbfad..f28955ba87c2f93ac27db6d2ac6274ff035ad897 100644 (file)
@@ -187,6 +187,7 @@ static bool m68k_output_addr_const_extra (FILE *, rtx);
 static void m68k_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
 static enum flt_eval_method
 m68k_excess_precision (enum excess_precision_type);
+static bool m68k_hard_regno_mode_ok (unsigned int, machine_mode);
 \f
 /* Initialize the GCC target structure.  */
 
@@ -334,6 +335,9 @@ m68k_excess_precision (enum excess_precision_type);
 #undef TARGET_ATOMIC_TEST_AND_SET_TRUEVAL
 #define TARGET_ATOMIC_TEST_AND_SET_TRUEVAL 128
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK m68k_hard_regno_mode_ok
+
 static const struct attribute_spec m68k_attribute_table[] =
 {
   /* { name, min_len, max_len, decl_req, type_req, fn_type_req, handler,
@@ -5170,12 +5174,12 @@ m68k_hard_regno_rename_ok (unsigned int old_reg ATTRIBUTE_UNUSED,
   return 1;
 }
 
-/* Value is true if hard register REGNO can hold a value of machine-mode
-   MODE.  On the 68000, we let the cpu registers can hold any mode, but
-   restrict the 68881 registers to floating-point modes.  */
+/* Implement TARGET_HARD_REGNO_MODE_OK.  On the 68000, we let the cpu
+   registers can hold any mode, but restrict the 68881 registers to
+   floating-point modes.  */
 
-bool
-m68k_regno_mode_ok (int regno, machine_mode mode)
+static bool
+m68k_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   if (DATA_REGNO_P (regno))
     {
index ba7feb07cbddf870f3ef1d1fe98c8dcd18770fa3..2c49dde0c23fbb4b5558e86efbc1fa7ecaab4da2 100644 (file)
@@ -394,9 +394,6 @@ along with GCC; see the file COPYING3.  If not see
 #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
   m68k_hard_regno_rename_ok (OLD_REG, NEW_REG)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-  m68k_regno_mode_ok ((REGNO), (MODE))
-
 #define SECONDARY_RELOAD_CLASS(CLASS, MODE, X) \
   m68k_secondary_reload_class (CLASS, MODE, X)
 
index 97fbb8c87686b74acd2830e892b16bfafd1bf6ef..69fa798b666a846da80fd02a792733d3d3feb26e 100644 (file)
@@ -144,6 +144,7 @@ static void       mcore_option_override             (void);
 static bool       mcore_legitimate_constant_p   (machine_mode, rtx);
 static bool      mcore_legitimate_address_p    (machine_mode, rtx, bool,
                                                 addr_space_t);
+static bool      mcore_hard_regno_mode_ok      (unsigned int, machine_mode);
 \f
 /* MCore specific attributes.  */
 
@@ -240,6 +241,9 @@ static const struct attribute_spec mcore_attribute_table[] =
 #undef TARGET_WARN_FUNC_RETURN
 #define TARGET_WARN_FUNC_RETURN mcore_warn_func_return
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK mcore_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Adjust the stack and return the number of bytes taken to do it.  */
@@ -3260,3 +3264,14 @@ mcore_legitimate_address_p (machine_mode mode, rtx x, bool strict_p,
   return false;
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  We may keep double values in
+   even registers.  */
+
+static bool
+mcore_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  if (TARGET_8ALIGN && GET_MODE_SIZE (mode) > UNITS_PER_WORD)
+    return (regno & 1) == 0;
+
+  return regno < 18;
+}
index 2f2e803676d9dc4aa0d1092d2f23edc91da7e37b..ef8f7f651cea39cacc7242163ffe0ec5f9d4dd89 100644 (file)
@@ -248,15 +248,10 @@ extern char * mcore_current_function_name;
 #define HARD_REGNO_NREGS(REGNO, MODE)  \
    (((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
-   We may keep double values in even registers.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE)  \
-  ((TARGET_8ALIGN && GET_MODE_SIZE (MODE) > UNITS_PER_WORD) ? (((REGNO) & 1) == 0) : (REGNO < 18))
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.  */
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.  */
 #define MODES_TIEABLE_P(MODE1, MODE2) \
   ((MODE1) == (MODE2) || GET_MODE_CLASS (MODE1) == GET_MODE_CLASS (MODE2))
 
index 2a291ea81fbc9584b59696472c51e17ab1c45b7f..75cb236cee9532015286b2675df72292b1f22b15 100644 (file)
@@ -176,8 +176,8 @@ REAL_VALUE_TYPE dfhigh, dflow, sfhigh, sflow;
 
 /* Array giving truth value on whether or not a given hard register
    can support a given mode.  */
-char microblaze_hard_regno_mode_ok[(int)MAX_MACHINE_MODE]
-                                 [FIRST_PSEUDO_REGISTER];
+static char microblaze_hard_regno_mode_ok_p[(int)MAX_MACHINE_MODE]
+                                          [FIRST_PSEUDO_REGISTER];
 
 /* Current frame information calculated by compute_frame_size.  */
 struct microblaze_frame_info current_frame_info;
@@ -1841,11 +1841,25 @@ microblaze_option_override (void)
          else
            ok = 0;
 
-         microblaze_hard_regno_mode_ok[(int) mode][regno] = ok;
+         microblaze_hard_regno_mode_ok_p[(int) mode][regno] = ok;
        }
     }
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  In 32 bit mode, require that
+   DImode and DFmode be in even registers.  For DImode, this makes some
+   of the insns easier to write, since you don't have to worry about a
+   DImode value in registers 3 & 4, producing a result in 4 & 5.
+
+   To make the code simpler, the hook now just references an
+   array built in override_options.  */
+
+static bool
+microblaze_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return microblaze_hard_regno_mode_ok_p[mode][regno];
+}
+
 /* Return true if FUNC is an interrupt function as specified
    by the "interrupt_handler" attribute.  */
 
@@ -3873,6 +3887,9 @@ microblaze_machine_dependent_reorg (void)
 #undef TARGET_MACHINE_DEPENDENT_REORG
 #define TARGET_MACHINE_DEPENDENT_REORG microblaze_machine_dependent_reorg
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK microblaze_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 #include "gt-microblaze.h"
index 2c9ece1d6c680b1a6ef3197390b625d717e05d94..5a0ea0a55ff8aa9ab5f5c0043a865df7827b940c 100644 (file)
@@ -295,20 +295,6 @@ extern enum pipeline_type microblaze_pipe;
 #define HARD_REGNO_NREGS(REGNO, MODE)                                  \
        ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode
-   MODE.  In 32 bit mode, require that DImode and DFmode be in even
-   registers.  For DImode, this makes some of the insns easier to
-   write, since you don't have to worry about a DImode value in
-   registers 3 & 4, producing a result in 4 & 5.
-
-   To make the code simpler HARD_REGNO_MODE_OK now just references an
-   array built in override_options.  Because machmodes.h is not yet
-   included before this file is processed, the MODE bound can't be
-   expressed here.  */
-extern char microblaze_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                                        \
-            microblaze_hard_regno_mode_ok[ (int)(MODE) ][ (REGNO)]
-
 #define MODES_TIEABLE_P(MODE1, MODE2)                                  \
   ((GET_MODE_CLASS (MODE1) == MODE_FLOAT ||                            \
     GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT)                      \
index 0ee6a31a8ca108cfa0fc518f142fbc14b1feb6cc..0d1265effdab1404420f3c12c765991b6f161cd0 100644 (file)
@@ -494,7 +494,7 @@ static int mips_base_align_jumps; /* align_jumps */
 static int mips_base_align_functions; /* align_functions */
 
 /* Index [M][R] is true if register R is allowed to hold a value of mode M.  */
-bool mips_hard_regno_mode_ok[(int) MAX_MACHINE_MODE][FIRST_PSEUDO_REGISTER];
+static bool mips_hard_regno_mode_ok_p[MAX_MACHINE_MODE][FIRST_PSEUDO_REGISTER];
 
 /* Index C is true if character C is a valid PRINT_OPERAND punctation
    character.  */
@@ -12725,7 +12725,7 @@ mips_can_use_return_insn (void)
    The result of this function is cached in mips_hard_regno_mode_ok.  */
 
 static bool
-mips_hard_regno_mode_ok_p (unsigned int regno, machine_mode mode)
+mips_hard_regno_mode_ok_uncached (unsigned int regno, machine_mode mode)
 {
   unsigned int size;
   enum mode_class mclass;
@@ -12830,6 +12830,14 @@ mips_hard_regno_mode_ok_p (unsigned int regno, machine_mode mode)
   return false;
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+mips_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return mips_hard_regno_mode_ok_p[mode][regno];
+}
+
 /* Return nonzero if register OLD_REG can be renamed to register NEW_REG.  */
 
 bool
@@ -12912,14 +12920,14 @@ mips_class_max_nregs (enum reg_class rclass, machine_mode mode)
   COPY_HARD_REG_SET (left, reg_class_contents[(int) rclass]);
   if (hard_reg_set_intersect_p (left, reg_class_contents[(int) ST_REGS]))
     {
-      if (HARD_REGNO_MODE_OK (ST_REG_FIRST, mode))
+      if (mips_hard_regno_mode_ok (ST_REG_FIRST, mode))
        size = MIN (size, 4);
 
       AND_COMPL_HARD_REG_SET (left, reg_class_contents[(int) ST_REGS]);
     }
   if (hard_reg_set_intersect_p (left, reg_class_contents[(int) FP_REGS]))
     {
-      if (HARD_REGNO_MODE_OK (FP_REG_FIRST, mode))
+      if (mips_hard_regno_mode_ok (FP_REG_FIRST, mode))
        {
          if (MSA_SUPPORTED_MODE_P (mode))
            size = MIN (size, UNITS_PER_MSA_REG);
@@ -20110,8 +20118,8 @@ mips_option_override (void)
   /* Set up mips_hard_regno_mode_ok.  */
   for (mode = 0; mode < MAX_MACHINE_MODE; mode++)
     for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
-      mips_hard_regno_mode_ok[mode][regno]
-       = mips_hard_regno_mode_ok_p (regno, (machine_mode) mode);
+      mips_hard_regno_mode_ok_p[mode][regno]
+       = mips_hard_regno_mode_ok_uncached (regno, (machine_mode) mode);
 
   /* Function to allocate machine-dependent function status.  */
   init_machine_status = &mips_init_machine_status;
@@ -22578,6 +22586,9 @@ mips_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
 #undef TARGET_HARD_REGNO_SCRATCH_OK
 #define TARGET_HARD_REGNO_SCRATCH_OK mips_hard_regno_scratch_ok
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK mips_hard_regno_mode_ok
+
 #undef TARGET_HARD_REGNO_CALL_PART_CLOBBERED
 #define TARGET_HARD_REGNO_CALL_PART_CLOBBERED \
   mips_hard_regno_call_part_clobbered
index 4358b92f637d81b04896a691636ee0b44e8c389e..b6a6740d2f5070634207d669a437c0a7c6f51474 100644 (file)
@@ -1961,9 +1961,6 @@ FP_ASM_SPEC "\
 
 #define HARD_REGNO_NREGS(REGNO, MODE) mips_hard_regno_nregs (REGNO, MODE)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                                        \
-  mips_hard_regno_mode_ok[ (int)(MODE) ][ (REGNO) ]
-
 #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG)                         \
   mips_hard_regno_rename_ok (OLD_REG, NEW_REG)
 
@@ -3214,7 +3211,6 @@ struct mips_asm_switch {
 };
 
 extern const enum reg_class mips_regno_to_class[];
-extern bool mips_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
 extern const char *current_function_file; /* filename current function is in */
 extern int num_source_filenames;       /* current .file # */
 extern struct mips_asm_switch mips_noreorder;
index 8cbb137648b56f2dc1f931c8bfb7385df24470f8..fc0589238b759075e99ae2d0d8927eaae1189dea 100644 (file)
@@ -386,8 +386,6 @@ struct GTY(()) machine_function
    ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1)        \
     / UNITS_PER_WORD)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
 /* Note that no register can really be accessed in single-float mode, so
    we *can* say 1 here.  FIXME:  Will TRT happen for single-float, or do
    we have to punt to libgcc1.asm?  */
index b2a0d3a85ce02427e2213fc0b0b1b265a2fb96e1..439092b031ce8d3674307e0157e08752838ad155 100644 (file)
@@ -25,7 +25,6 @@ extern rtx   mn10300_legitimize_reload_address (rtx, machine_mode,
                                                int, int, int);
 extern bool  mn10300_function_value_regno_p (const unsigned int);
 extern unsigned int   mn10300_get_live_callee_saved_regs (unsigned int *);
-extern bool  mn10300_hard_regno_mode_ok (unsigned int, machine_mode);
 extern bool  mn10300_modes_tieable (machine_mode, machine_mode);
 extern const char *mn10300_output_add (rtx[3], bool);
 extern void  mn10300_print_operand (FILE *, rtx, int);
index 53adf33cb5fa8b232f784c15137bf0d44b27eb5f..738f04c82b40629d9bf9d6badb9ed3dc5522201b 100644 (file)
@@ -2626,7 +2626,9 @@ mn10300_can_output_mi_thunk (const_tree    thunk_fndecl ATTRIBUTE_UNUSED,
   return true;
 }
 
-bool
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
 mn10300_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   if (REGNO_REG_CLASS (regno) == FP_REGS
@@ -3425,4 +3427,7 @@ mn10300_reorg (void)
 #undef  TARGET_FLAGS_REGNUM
 #define TARGET_FLAGS_REGNUM  CC_REG
 
+#undef  TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK mn10300_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
index d21c299e8ffcd569f7225fbcaec7cc7e1e76adc2..b669fe700554869f03596a23f609905d23d2250c 100644 (file)
@@ -233,15 +233,10 @@ extern enum processor_type mn10300_tune_cpu;
 #define HARD_REGNO_NREGS(REGNO, MODE)   \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode
-   MODE.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-  mn10300_hard_regno_mode_ok ((REGNO), (MODE))
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.  */
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.  */
 #define MODES_TIEABLE_P(MODE1, MODE2) \
   mn10300_modes_tieable ((MODE1), (MODE2))
 
index 41610366f58392d68b99d6bf2c08018e8e81c306..09a720f513880eb0dee6b64fdf156f3cbdec63bb 100644 (file)
@@ -171,12 +171,6 @@ enum reg_class
 /* We can't copy to or from our CC register. */
 #define AVOID_CCMODE_COPIES 1
 
-/* A C expression that is nonzero if it is permissible to store a
-   value of mode MODE in hard register number REGNO (or in several
-   registers starting with that one).  All gstore registers are 
-   equivalent, so we can set this to 1.  */
-#define HARD_REGNO_MODE_OK(R,M) 1
-
 /* A C expression whose value is a register class containing hard
    register REGNO.  */
 #define REGNO_REG_CLASS(R) ((R < MOXIE_PC) ? GENERAL_REGS :            \
index 790be7e9c16ad456fb3e72497a8d8eb1935160f4..7935088c78afb81e5705275ccc217ef8f186091f 100644 (file)
@@ -29,7 +29,6 @@ void  msp430_expand_helper (rtx *operands, const char *, bool);
 void   msp430_expand_prologue (void);
 const char * msp430x_extendhisi (rtx *);
 void   msp430_fixup_compare_operands (machine_mode, rtx *);
-int    msp430_hard_regno_mode_ok (int, machine_mode);
 int    msp430_hard_regno_nregs (int, machine_mode);
 int    msp430_hard_regno_nregs_has_padding (int, machine_mode);
 int    msp430_hard_regno_nregs_with_padding (int, machine_mode);
index b8b21255c5539065e2942f59b5707cdab8536acb..eb92c488d6a079787adf1199a7ebc0e1b3ce17d5 100644 (file)
@@ -933,12 +933,14 @@ msp430_hard_regno_nregs_with_padding (int regno ATTRIBUTE_UNUSED,
   return msp430_hard_regno_nregs (regno, mode);
 }
 
-/* Implements HARD_REGNO_MODE_OK.  */
-int
-msp430_hard_regno_mode_ok (int regno ATTRIBUTE_UNUSED,
-                          machine_mode mode)
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK msp430_hard_regno_mode_ok
+
+static bool
+msp430_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
-  return regno <= (ARG_POINTER_REGNUM - msp430_hard_regno_nregs (regno, mode));
+  return regno <= (ARG_POINTER_REGNUM
+                  - (unsigned int) msp430_hard_regno_nregs (regno, mode));
 }
 
 /* Implements MODES_TIEABLE_P.  */
index e95106dd01c8a72a296eaf34b86887e815bff47d..86cef2cbb0488caeab731853f3fc5cb5be80b963 100644 (file)
@@ -335,9 +335,6 @@ typedef struct
 #define HARD_REGNO_NREGS(REGNO, MODE)            \
   msp430_hard_regno_nregs (REGNO, MODE)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                        \
-  msp430_hard_regno_mode_ok (REGNO, MODE)
-
 #define MODES_TIEABLE_P(MODE1, MODE2)                          \
   msp430_modes_tieable_p (MODE1, MODE2)
 \f
index ada1aab647d242e8fe5b7c64a56bed7ab3164114..741e874105d87a674cdfc150cb8246a6d36ccb2e 100644 (file)
@@ -31,7 +31,6 @@ extern void nds32_init_expanders (void);
 /* -- How Values Fit in Registers.  */
 
 extern int nds32_hard_regno_nregs (int, machine_mode);
-extern int nds32_hard_regno_mode_ok (int, machine_mode);
 
 \f
 /* Register Classes.  */
index 48344ddb4b3dadc9c7a7a81b3fb8056050f1c4ee..defd723f775711c52631e364663912134628b1e5 100644 (file)
@@ -2753,17 +2753,21 @@ nds32_hard_regno_nregs (int regno ATTRIBUTE_UNUSED,
   return ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD);
 }
 
-int
-nds32_hard_regno_mode_ok (int regno, machine_mode mode)
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+nds32_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   /* Restrict double-word quantities to even register pairs.  */
   if (HARD_REGNO_NREGS (regno, mode) == 1
       || !((regno) & 1))
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK nds32_hard_regno_mode_ok
 \f
 /* Register Classes.  */
 
index 5b970b76234ffd535efeb32e4878981a8ebc589b..274d2a74b893c6bb23b523a94c1a0ee8f6ad6149 100644 (file)
@@ -600,10 +600,6 @@ enum nds32_builtins
    reg "regno" for holding a value of mode "mode".  */
 #define HARD_REGNO_NREGS(regno, mode) nds32_hard_regno_nregs (regno, mode)
 
-/* Value is 1 if hard register "regno" can hold a value
-   of machine-mode "mode".  */
-#define HARD_REGNO_MODE_OK(regno, mode) nds32_hard_regno_mode_ok (regno, mode)
-
 /* A C expression that is nonzero if a value of mode1
    is accessible in mode2 without copying.
    Define this macro to return nonzero in as many cases as possible
index 19506ba2cb82ed688d76bd2ee6df6bc7f5157d64..adbf56258e77189ddc71b119c05746063f0f2b88 100644 (file)
   }
 
 #define MODES_TIEABLE_P(MODE1, MODE2) 1
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
 #define HARD_REGNO_NREGS(REGNO, MODE)            \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
index 4224acf26e28534c67e41d0c714fc43601049c35..fea56d8e6eef18ada1b29bb24d511e94c699f51a 100644 (file)
@@ -99,8 +99,6 @@
   ((void)(REG), (void)(MODE), 1)
 #define CANNOT_CHANGE_MODE_CLASS(M1, M2, CLS)  \
   ((void)(M1), (void)(M2), (void)(CLS), true)
-#define HARD_REGNO_MODE_OK(REG, MODE)          \
-     ((void)(REG), (void)(MODE), true)
 
 /* Register Classes.  */
 enum reg_class             {  NO_REGS,    ALL_REGS,    LIM_REG_CLASSES };
index 6783fe3b0e890ee059ff6a50ff2f0ded8c71d3c8..c3bc01e4a54dafcbfdf122f1a9ec2afcdb9e48e2 100644 (file)
@@ -198,6 +198,7 @@ static unsigned int pa_section_type_flags (tree, const char *, int);
 static bool pa_legitimate_address_p (machine_mode, rtx, bool);
 static bool pa_callee_copies (cumulative_args_t, machine_mode,
                              const_tree, bool);
+static bool pa_hard_regno_mode_ok (unsigned int, machine_mode);
 
 /* The following extra sections are only used for SOM.  */
 static GTY(()) section *som_readonly_data_section;
@@ -404,6 +405,9 @@ static size_t n_deferred_plabels = 0;
 #undef TARGET_LRA_P
 #define TARGET_LRA_P hook_bool_void_false
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK pa_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 /* Parse the -mfixed-range= option string.  */
@@ -9998,7 +10002,7 @@ pa_cannot_change_mode_class (machine_mode from, machine_mode to,
   if (MAYBE_FP_REG_CLASS_P (rclass))
     return true;
 
-  /* HARD_REGNO_MODE_OK places modes with sizes larger than a word
+  /* TARGET_HARD_REGNO_MODE_OK places modes with sizes larger than a word
      in specific sets of registers.  Thus, we cannot allow changing
      to a larger mode when it's larger than a word.  */
   if (GET_MODE_SIZE (to) > UNITS_PER_WORD
@@ -10010,13 +10014,13 @@ pa_cannot_change_mode_class (machine_mode from, machine_mode to,
 
 /* Returns TRUE if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be FALSE for correct output.
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be FALSE for correct output.
    
    We should return FALSE for QImode and HImode because these modes
    are not ok in the floating-point registers.  However, this prevents
    tieing these modes to SImode and DImode in the general registers.
-   So, this isn't a good idea.  We rely on HARD_REGNO_MODE_OK and
+   So, this isn't a good idea.  We rely on TARGET_HARD_REGNO_MODE_OK and
    CANNOT_CHANGE_MODE_CLASS to prevent these modes from being used
    in the floating-point registers.  */
 
@@ -10756,4 +10760,12 @@ pa_callee_copies (cumulative_args_t cum ATTRIBUTE_UNUSED,
   return !TARGET_CALLER_COPIES;
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+pa_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return PA_HARD_REGNO_MODE_OK (regno, mode);
+}
+
 #include "gt-pa.h"
index 65df53e54b08efce8a57e74559e592f1c8bf77f1..4ae0597ff8ba6b8dbc35756fb0284a17626f9cb9 100644 (file)
@@ -324,10 +324,10 @@ typedef struct GTY(()) machine_function
    when given unaligned data.  */
 #define STRICT_ALIGNMENT 1
 
-/* Value is 1 if it is a good idea to tie two pseudo registers
-   when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.  */
+/* Value is 1 if it is a good idea to tie two pseudo registers when one
+   has mode MODE1 and one has mode MODE2.
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.  */
 #define MODES_TIEABLE_P(MODE1, MODE2) \
   pa_modes_tieable_p (MODE1, MODE2)
 
index 6d854cf69e37e389ad67ab0eadead4552cde656c..bb7b9abfb1f26e9453a688a37f4d413d42c57ad5 100644 (file)
@@ -206,7 +206,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    supported under HP-UX using libcalls.  Since TFmode values are passed
    by reference, they never need to be loaded into the floating-point
    registers.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
+#define PA_HARD_REGNO_MODE_OK(REGNO, MODE) \
   ((REGNO) == 0 ? (MODE) == CCmode || (MODE) == CCFPmode               \
    : (REGNO) == 88 ? SCALAR_INT_MODE_P (MODE)                          \
    : !TARGET_PA_11 && FP_REGNO_P (REGNO)                               \
index 204be57f94840c89326c9d26aec2fef2dcbc0620..ffbcb446a4164f9e3abfadbcbcfb9d02d4505b18 100644 (file)
@@ -149,7 +149,7 @@ along with GCC; see the file COPYING3.  If not see
 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
    On the HP-PA, the cpu registers can hold any mode.  We
    force this to be an even register if it cannot hold the full mode.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
+#define PA_HARD_REGNO_MODE_OK(REGNO, MODE) \
   ((REGNO) == 0                                                                \
    ? (MODE) == CCmode || (MODE) == CCFPmode                            \
    : (REGNO) == 60 ? SCALAR_INT_MODE_P (MODE)                          \
index b4d54fc0a78563500ab6c2351779d0c6f3f38e91..d8fe00cd71bb7701774789db2a63129e081e75fc 100644 (file)
@@ -235,6 +235,9 @@ static bool pdp11_scalar_mode_supported_p (scalar_mode);
 
 #undef  TARGET_SCALAR_MODE_SUPPORTED_P
 #define TARGET_SCALAR_MODE_SUPPORTED_P pdp11_scalar_mode_supported_p
+
+#undef  TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK pdp11_hard_regno_mode_ok
 \f
 /* A helper function to determine if REGNO should be saved in the
    current function's stack frame.  */
@@ -1925,4 +1928,23 @@ pdp11_branch_cost ()
   return (TARGET_BRANCH_CHEAP ? 0 : 1);
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  On the pdp, the cpu registers
+   can hold any mode other than float (because otherwise we may end up
+   being asked to move from CPU to FPU register, which isn't a valid
+   operation on the PDP11).  For CPU registers, check alignment.
+
+   FPU accepts SF and DF but actually holds a DF - simplifies life!  */
+
+static bool
+pdp11_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  if (regno <= PC_REGNUM)
+    return (GET_MODE_BITSIZE (mode) <= 16
+           || (GET_MODE_BITSIZE (mode) >= 32
+               && !(regno & 1)
+               && !FLOAT_MODE_P (mode)));
+
+  return FLOAT_MODE_P (mode);
+}
+
 struct gcc_target targetm = TARGET_INITIALIZER;
index 474b3ef4f3ec55cf8f8c35dbf59f40f169dd71c0..6314702e208af55c3b6d3b10043d774d34b8d36e 100644 (file)
@@ -176,26 +176,10 @@ extern const struct real_format pdp11_d_format;
     :1)
     
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
-   On the pdp, the cpu registers can hold any mode other than float
-   (because otherwise we may end up being asked to move from CPU to FPU
-   register, which isn't a valid operation on the PDP11).
-   For CPU registers, check alignment.
-
-   FPU accepts SF and DF but actually holds a DF - simplifies life!
-*/
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-(((REGNO) <= PC_REGNUM)?                               \
-  ((GET_MODE_BITSIZE(MODE) <= 16)                      \
-   || (GET_MODE_BITSIZE(MODE) >= 32 &&                 \
-       !((REGNO) & 1) && !FLOAT_MODE_P (MODE)))                \
-  :FLOAT_MODE_P (MODE))
-    
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.  */
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.  */
 #define MODES_TIEABLE_P(MODE1, MODE2) 0
 
 /* Specify the registers used for certain standard purposes.
index 0344823db0a8404e68cb945a41fe5bbb79e525cc..0f3e492a8a1073d2152f4aad3455ab6388624243 100644 (file)
@@ -254,7 +254,6 @@ const char * rs6000_xcoff_strip_dollar (const char *);
 
 void rs6000_final_prescan_insn (rtx_insn *, rtx *operand, int num_operands);
 
-extern bool rs6000_hard_regno_mode_ok_p[][FIRST_PSEUDO_REGISTER];
 extern unsigned char rs6000_class_max_nregs[][LIM_REG_CLASSES];
 extern unsigned char rs6000_hard_regno_nregs[][FIRST_PSEUDO_REGISTER];
 
index 4c37be79a50978704e2082fc0429d360b9c363e5..67021f62899269580d4d7989c4e1ce4091bb4c31 100644 (file)
@@ -210,7 +210,8 @@ static bool rs6000_returns_struct;
 #endif
 
 /* Value is TRUE if register/mode pair is acceptable.  */
-bool rs6000_hard_regno_mode_ok_p[NUM_MACHINE_MODES][FIRST_PSEUDO_REGISTER];
+static bool rs6000_hard_regno_mode_ok_p
+  [NUM_MACHINE_MODES][FIRST_PSEUDO_REGISTER];
 
 /* Maximum number of registers needed for a given register class and mode.  */
 unsigned char rs6000_class_max_nregs[NUM_MACHINE_MODES][LIM_REG_CLASSES];
@@ -1972,6 +1973,9 @@ static const struct attribute_spec rs6000_attribute_table[] =
 #undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS
 #define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 1
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK rs6000_hard_regno_mode_ok
+
 #undef TARGET_HARD_REGNO_CALL_PART_CLOBBERED
 #define TARGET_HARD_REGNO_CALL_PART_CLOBBERED \
   rs6000_hard_regno_call_part_clobbered
@@ -2060,7 +2064,7 @@ rs6000_hard_regno_nregs_internal (int regno, machine_mode mode)
 /* Value is 1 if hard register REGNO can hold a value of machine-mode
    MODE.  */
 static int
-rs6000_hard_regno_mode_ok (int regno, machine_mode mode)
+rs6000_hard_regno_mode_ok_uncached (int regno, machine_mode mode)
 {
   int last_regno = regno + rs6000_hard_regno_nregs[mode][regno] - 1;
 
@@ -2160,6 +2164,14 @@ rs6000_hard_regno_mode_ok (int regno, machine_mode mode)
   return GET_MODE_SIZE (mode) <= UNITS_PER_WORD;
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+rs6000_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return rs6000_hard_regno_mode_ok_p[mode][regno];
+}
+
 /* Implement TARGET_HARD_REGNO_CALL_PART_CLOBBERED.  */
 
 static bool
@@ -3684,10 +3696,10 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p)
       rs6000_hard_regno_nregs[m][r]
        = rs6000_hard_regno_nregs_internal (r, (machine_mode)m);
 
-  /* Precalculate HARD_REGNO_MODE_OK.  */
+  /* Precalculate TARGET_HARD_REGNO_MODE_OK.  */
   for (r = 0; r < FIRST_PSEUDO_REGISTER; ++r)
     for (m = 0; m < NUM_MACHINE_MODES; ++m)
-      if (rs6000_hard_regno_mode_ok (r, (machine_mode)m))
+      if (rs6000_hard_regno_mode_ok_uncached (r, (machine_mode)m))
        rs6000_hard_regno_mode_ok_p[m][r] = true;
 
   /* Precalculate CLASS_MAX_NREGS sizes.  */
index 4e4078f3377497b25dae39b063fb66e03362c68a..75d59f419fe0e435acc320617fb8e3843a8cf6bc 100644 (file)
@@ -1330,15 +1330,10 @@ enum data_align { align_abi, align_opt, align_both };
 #define PAIRED_VECTOR_MODE(MODE)        \
          ((MODE) == V2SFmode)            
 
-/* Value is TRUE if hard register REGNO can hold a value of
-   machine-mode MODE.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-  rs6000_hard_regno_mode_ok_p[(int)(MODE)][REGNO]
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.
 
    PTImode cannot tie with other modes because PTImode is restricted to even
    GPR registers, and TImode can go in any GPR as well as VSX registers (PR
index aa57d1a71529983060225c0e7beb496cd84dd3ba..0d3c21ea9e05adbb3586f28a2fb27b65c92579ac 100644 (file)
@@ -39,7 +39,6 @@ enum riscv_symbol_type {
 extern enum riscv_symbol_type riscv_classify_symbolic_expression (rtx);
 extern bool riscv_symbolic_constant_p (rtx, enum riscv_symbol_type *);
 extern int riscv_regno_mode_ok_for_base_p (int, machine_mode, bool);
-extern bool riscv_hard_regno_mode_ok_p (unsigned int, machine_mode);
 extern int riscv_address_insns (rtx, machine_mode, bool);
 extern int riscv_const_insns (rtx);
 extern int riscv_split_const_insns (rtx);
index cbf2f79bc4d833a54cecb17448c55498bddbced7..defe8f2ba09e8c6e73a8aa2c4bff13c8a032e103 100644 (file)
@@ -3519,10 +3519,10 @@ riscv_register_move_cost (machine_mode mode,
   return SECONDARY_MEMORY_NEEDED (from, to, mode) ? 8 : 2;
 }
 
-/* Return true if register REGNO can store a value of mode MODE.  */
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
 
-bool
-riscv_hard_regno_mode_ok_p (unsigned int regno, machine_mode mode)
+static bool
+riscv_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   unsigned int nregs = riscv_hard_regno_nregs (regno, mode);
 
@@ -4083,6 +4083,9 @@ riscv_cannot_copy_insn_p (rtx_insn *insn)
 #undef TARGET_EXPAND_BUILTIN
 #define TARGET_EXPAND_BUILTIN riscv_expand_builtin
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK riscv_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-riscv.h"
index 30d2ae260d2289fd0341d35e8e6a4072b8bfe971..6f07b541893866ec897dad0a74b115312287a1c7 100644 (file)
@@ -296,9 +296,6 @@ along with GCC; see the file COPYING3.  If not see
 
 #define HARD_REGNO_NREGS(REGNO, MODE) riscv_hard_regno_nregs (REGNO, MODE)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                                        \
-  riscv_hard_regno_mode_ok_p (REGNO, MODE)
-
 /* Don't allow floating-point modes to be tied, since type punning of
    single-precision and double-precision is implementation defined.  */
 #define MODES_TIEABLE_P(MODE1, MODE2)                  \
@@ -864,7 +861,6 @@ while (0)
 
 #ifndef USED_FOR_TARGET
 extern const enum reg_class riscv_regno_to_class[];
-extern bool riscv_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
 extern bool riscv_slow_unaligned_access;
 #endif
 
index 256198417172a5befaa588e5246b9a76c8891aa6..569146a6219f3c8bca7178a27d40b31f62c1ed18 100644 (file)
@@ -29,7 +29,6 @@ void          rl78_expand_eh_epilogue (rtx);
 void           rl78_expand_epilogue (void);
 void           rl78_expand_prologue (void);
 int            rl78_far_p (rtx x);
-int            rl78_hard_regno_mode_ok (int, machine_mode);
 int            rl78_hard_regno_nregs (int, machine_mode);
 bool           rl78_hl_b_c_addr_p (rtx);
 int            rl78_initial_elimination_offset (int, int);
index 429e934f37a048539aa5d520c6398240ac892589..8dd593e5b1a4d9e2684b2e9d14a9d78c76d8946b 100644 (file)
@@ -459,34 +459,36 @@ rl78_hard_regno_nregs (int regno, machine_mode mode)
   return ((GET_MODE_SIZE (mode) + rs - 1) / rs);
 }
 
-/* Implements HARD_REGNO_MODE_OK.  */
-int
-rl78_hard_regno_mode_ok (int regno, machine_mode mode)
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK rl78_hard_regno_mode_ok
+
+static bool
+rl78_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   int s = GET_MODE_SIZE (mode);
 
   if (s < 1)
-    return 0;
+    return false;
   /* These are not to be used by gcc.  */
   if (regno == 23 || regno == ES_REG || regno == CS_REG)
-    return 0;
+    return false;
   /* $fp can always be accessed as a 16-bit value.  */
   if (regno == FP_REG && s == 2)
-    return 1;
+    return true;
   if (regno < SP_REG)
     {
       /* Since a reg-reg move is really a reg-mem move, we must
         enforce alignment.  */
       if (s > 1 && (regno % 2))
-       return 0;
-      return 1;
+       return false;
+      return true;
     }
   if (s == CC_REGNUM)
     return (mode == BImode);
   /* All other registers must be accessed in their natural sizes.  */
   if (s == register_sizes [regno])
-    return 1;
-  return 0;
+    return true;
+  return false;
 }
 
 /* Simplify_gen_subreg() doesn't handle memory references the way we
index b4cd2b46be8f9faeff2ead971463e6228a1f3062..18df6658e59728c330f4600bd6b04388da36ced8 100644 (file)
@@ -410,9 +410,6 @@ typedef unsigned int CUMULATIVE_ARGS;
 #define HARD_REGNO_NREGS(REGNO, MODE)            \
   rl78_hard_regno_nregs (REGNO, MODE)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                        \
-  rl78_hard_regno_mode_ok (REGNO, MODE)
-
 #define MODES_TIEABLE_P(MODE1, MODE2)                          \
   (   (   GET_MODE_CLASS (MODE1) == MODE_FLOAT                 \
        || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT)                \
index 144bdb26fa4ee0e6b34313cc1def7db00cb58510..95fb3ad3149dfcb937b6406c95974ae148830fec 100644 (file)
@@ -255,7 +255,6 @@ const char * rs6000_xcoff_strip_dollar (const char *);
 
 void rs6000_final_prescan_insn (rtx_insn *, rtx *operand, int num_operands);
 
-extern bool rs6000_hard_regno_mode_ok_p[][FIRST_PSEUDO_REGISTER];
 extern unsigned char rs6000_class_max_nregs[][LIM_REG_CLASSES];
 extern unsigned char rs6000_hard_regno_nregs[][FIRST_PSEUDO_REGISTER];
 
index 9c6beb1839a9b8caa481efaa63d4152078159307..b9d7b55f7f54403606f5ed168ce1a652dfe9ad4c 100644 (file)
@@ -201,7 +201,8 @@ static bool rs6000_returns_struct;
 #endif
 
 /* Value is TRUE if register/mode pair is acceptable.  */
-bool rs6000_hard_regno_mode_ok_p[NUM_MACHINE_MODES][FIRST_PSEUDO_REGISTER];
+static bool rs6000_hard_regno_mode_ok_p
+  [NUM_MACHINE_MODES][FIRST_PSEUDO_REGISTER];
 
 /* Maximum number of registers needed for a given register class and mode.  */
 unsigned char rs6000_class_max_nregs[NUM_MACHINE_MODES][LIM_REG_CLASSES];
@@ -1962,6 +1963,9 @@ static const struct attribute_spec rs6000_attribute_table[] =
 #undef TARGET_OPTION_FUNCTION_VERSIONS
 #define TARGET_OPTION_FUNCTION_VERSIONS common_function_versions
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK rs6000_hard_regno_mode_ok
+
 #undef TARGET_HARD_REGNO_CALL_PART_CLOBBERED
 #define TARGET_HARD_REGNO_CALL_PART_CLOBBERED \
   rs6000_hard_regno_call_part_clobbered
@@ -2034,7 +2038,7 @@ rs6000_hard_regno_nregs_internal (int regno, machine_mode mode)
 /* Value is 1 if hard register REGNO can hold a value of machine-mode
    MODE.  */
 static int
-rs6000_hard_regno_mode_ok (int regno, machine_mode mode)
+rs6000_hard_regno_mode_ok_uncached (int regno, machine_mode mode)
 {
   int last_regno = regno + rs6000_hard_regno_nregs[mode][regno] - 1;
 
@@ -2127,6 +2131,14 @@ rs6000_hard_regno_mode_ok (int regno, machine_mode mode)
   return GET_MODE_SIZE (mode) <= UNITS_PER_WORD;
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+rs6000_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return rs6000_hard_regno_mode_ok_p[mode][regno];
+}
+
 /* Implement TARGET_HARD_REGNO_CALL_PART_CLOBBERED.  */
 
 static bool
@@ -3598,10 +3610,10 @@ rs6000_init_hard_regno_mode_ok (bool global_init_p)
       rs6000_hard_regno_nregs[m][r]
        = rs6000_hard_regno_nregs_internal (r, (machine_mode)m);
 
-  /* Precalculate HARD_REGNO_MODE_OK.  */
+  /* Precalculate TARGET_HARD_REGNO_MODE_OK.  */
   for (r = 0; r < FIRST_PSEUDO_REGISTER; ++r)
     for (m = 0; m < NUM_MACHINE_MODES; ++m)
-      if (rs6000_hard_regno_mode_ok (r, (machine_mode)m))
+      if (rs6000_hard_regno_mode_ok_uncached (r, (machine_mode)m))
        rs6000_hard_regno_mode_ok_p[m][r] = true;
 
   /* Precalculate CLASS_MAX_NREGS sizes.  */
index 9114b35e46f66b31afbf9d06392c479aed130416..90eaff5493ffc192900c485a4a9afdbd04e8fc7f 100644 (file)
@@ -1258,15 +1258,10 @@ enum data_align { align_abi, align_opt, align_both };
 #define PAIRED_VECTOR_MODE(MODE)        \
          ((MODE) == V2SFmode)            
 
-/* Value is TRUE if hard register REGNO can hold a value of
-   machine-mode MODE.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-  rs6000_hard_regno_mode_ok_p[(int)(MODE)][REGNO]
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.
 
    PTImode cannot tie with other modes because PTImode is restricted to even
    GPR registers, and TImode can go in any GPR as well as VSX registers (PR
index 06406f68f048843f40d43ab196093d44117c2e11..de35419d8e8f9aa5310397943e473775633e7116 100644 (file)
@@ -3434,6 +3434,13 @@ rx_atomic_sequence::~rx_atomic_sequence (void)
     emit_insn (gen_mvtc (GEN_INT (CTRLREG_PSW), m_prev_psw_reg));
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+rx_hard_regno_mode_ok (unsigned int regno, machine_mode)
+{
+  return REGNO_REG_CLASS (regno) == GR_REGS;
+}
 \f
 #undef  TARGET_NARROW_VOLATILE_BITFIELD
 #define TARGET_NARROW_VOLATILE_BITFIELD                rx_narrow_volatile_bitfield
@@ -3588,6 +3595,9 @@ rx_atomic_sequence::~rx_atomic_sequence (void)
 #undef  TARGET_LRA_P
 #define TARGET_LRA_P                           rx_enable_lra
 
+#undef  TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK              rx_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-rx.h"
index a8aebfaed326895be52b2eaece598acbcc5d4989..67bfeb7272fa7d78dfddd052cf8e46f7d92efeb9 100644 (file)
@@ -333,9 +333,6 @@ typedef unsigned int CUMULATIVE_ARGS;
 
 #define HARD_REGNO_NREGS(REGNO, MODE)   CLASS_MAX_NREGS (0, MODE)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                                \
-  (REGNO_REG_CLASS (REGNO) == GR_REGS)
-
 #define MODES_TIEABLE_P(MODE1, MODE2)                          \
   (   (   GET_MODE_CLASS (MODE1) == MODE_FLOAT                 \
        || GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT)                \
index 6df37ef9bf7b385987c153917c1a5e35b712f189..dd6c0c1bf19b9940b6efc942c606c88de68ad0db 100644 (file)
@@ -47,7 +47,6 @@ extern bool s390_can_use_simple_return_insn (void);
 extern bool s390_can_use_return_insn (void);
 extern void s390_function_profiler (FILE *, int);
 extern void s390_set_has_landing_pad_p (bool);
-extern bool s390_hard_regno_mode_ok (unsigned int, machine_mode);
 extern bool s390_hard_regno_rename_ok (unsigned int, unsigned int);
 extern int s390_class_max_nregs (enum reg_class, machine_mode);
 extern int s390_cannot_change_mode_class (machine_mode, machine_mode,
index 86b77138d0a3252c72a4f593e2fc2a521d432a99..c7d255d70d8359b7eac420bb69763346999d14d9 100644 (file)
@@ -87,6 +87,8 @@ along with GCC; see the file COPYING3.  If not see
 /* This file should be included last.  */
 #include "target-def.h"
 
+static bool s390_hard_regno_mode_ok (unsigned int, machine_mode);
+
 /* Remember the last target of s390_set_current_function.  */
 static GTY(()) tree s390_previous_fndecl;
 
@@ -10386,9 +10388,9 @@ s390_optimize_nonescaping_tx (void)
   return;
 }
 
-/* Return true if it is legal to put a value with MODE into REGNO.  */
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
 
-bool
+static bool
 s390_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   if (!TARGET_VX && VECTOR_NOFP_REGNO_P (regno))
@@ -15961,6 +15963,9 @@ s390_asan_shadow_offset (void)
 #undef TARGET_HARD_REGNO_SCRATCH_OK
 #define TARGET_HARD_REGNO_SCRATCH_OK s390_hard_regno_scratch_ok
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK s390_hard_regno_mode_ok
+
 #undef TARGET_HARD_REGNO_CALL_PART_CLOBBERED
 #define TARGET_HARD_REGNO_CALL_PART_CLOBBERED \
   s390_hard_regno_call_part_clobbered
index bdeba1e867647813ded9842b6537b838e38e2414..43f6975ee192f5d06f2f4f900db3b980031d6c3b 100644 (file)
@@ -499,9 +499,6 @@ extern const char *s390_host_detect_local_cpu (int argc, const char **argv);
 #define HARD_REGNO_NREGS(REGNO, MODE)                           \
   s390_class_max_nregs (REGNO_REG_CLASS (REGNO), (MODE))
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE)         \
-  s390_hard_regno_mode_ok ((REGNO), (MODE))
-
 #define HARD_REGNO_RENAME_OK(FROM, TO)          \
   s390_hard_regno_rename_ok ((FROM), (TO))
 
index 305ab2cd19bc695741fadfcfc235f6d0f7f6543c..b52860d18bc1fc4b986b7cd97593867d8c654db4 100644 (file)
@@ -361,7 +361,6 @@ extern bool sh_loads_bankedreg_p (rtx);
 extern int sh2a_get_function_vector_number (rtx);
 extern bool sh2a_is_function_vector_call (rtx);
 extern void sh_fix_range (const char *);
-extern bool sh_hard_regno_mode_ok (unsigned int, machine_mode);
 extern machine_mode sh_hard_regno_caller_save_mode (unsigned int, unsigned int,
                                                    machine_mode);
 extern bool sh_can_use_simple_return_p (void);
index c68b0777497fcae18d5ab68cf8bada3a3f88985b..e9487f1812b21779045d2ef125545f14a4d3bd98 100644 (file)
@@ -321,6 +321,7 @@ static bool sh_legitimate_combined_insn (rtx_insn* insn);
 static bool sh_fixed_condition_code_regs (unsigned int* p1, unsigned int* p2);
 
 static void sh_init_sync_libfuncs (void) ATTRIBUTE_UNUSED;
+static bool sh_hard_regno_mode_ok (unsigned int, machine_mode);
 \f
 static const struct attribute_spec sh_attribute_table[] =
 {
@@ -641,6 +642,9 @@ static const struct attribute_spec sh_attribute_table[] =
 #undef TARGET_CANNOT_FORCE_CONST_MEM
 #define TARGET_CANNOT_FORCE_CONST_MEM sh_cannot_force_const_mem_p
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK sh_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
 
@@ -10494,7 +10498,8 @@ sh_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
   return target;
 }
 
-/* Return true if hard register REGNO can hold a value of machine-mode MODE.
+/* Implement TARGET_HARD_REGNO_MODE_OK.
+
    We can allow any mode in any general register.  The special registers
    only allow SImode.  Don't allow any mode in the PR.
 
@@ -10509,7 +10514,7 @@ sh_expand_builtin (tree exp, rtx target, rtx subtarget ATTRIBUTE_UNUSED,
 
    We want to allow TImode FP regs so that when V4SFmode is loaded as TImode,
    it won't be ferried through GP registers first.  */
-bool
+static bool
 sh_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 {
   if (SPECIAL_REGISTER_P (regno))
@@ -10569,7 +10574,7 @@ sh_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
 }
 
 /* Specify the modes required to caller save a given hard regno.
-   choose_hard_reg_mode chooses mode based on HARD_REGNO_MODE_OK
+   choose_hard_reg_mode chooses mode based on TARGET_HARD_REGNO_MODE_OK
    and returns ?Imode for float regs when sh_hard_regno_mode_ok
    permits integer modes on them.  That makes LRA's split process
    unhappy.  See PR55212.
index 195f50419783aeab7fb9bd46e36135241e07a930..ac991af7bf03cb5f1125b25ff28dc7bcc445e78e 100644 (file)
@@ -823,14 +823,10 @@ extern char sh_additional_register_names[ADDREGNAMES_SIZE] \
     ? ((GET_MODE_SIZE (MODE) + (2*UNITS_PER_WORD - 1)) / (2*UNITS_PER_WORD)) \
     : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE)        \
-  sh_hard_regno_mode_ok ((REGNO), (MODE))
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.
    That's the case for xd registers: we don't hold SFmode values in
    them, so we can't tie an SFmode pseudos with one in another
    floating-point mode.  */
index cff5a61b1de2e3880d4548bb3dda40f8fdd07dd9..42a6851851b0554b923fc52033a6b0180244ea10 100644 (file)
 ;; register into the register class, which would not restrict things
 ;; at all.
 ;;
-;; Using a combination of GENERAL_REGS and HARD_REGNO_MODE_OK is not a
-;; full solution either.  In fact, even though IRA uses the macro
-;; HARD_REGNO_MODE_OK to calculate which registers are prohibited from
-;; use in certain modes, it still can allocate an odd hard register
+;; Using a combination of GENERAL_REGS and TARGET_HARD_REGNO_MODE_OK is
+;; not a full solution either.  In fact, even though IRA uses the macro
+;; TARGET_HARD_REGNO_MODE_OK to calculate which registers are prohibited
+;; from use in certain modes, it still can allocate an odd hard register
 ;; for DImode values.  This is due to how IRA populates the table
 ;; ira_useful_class_mode_regs[][].  It suffers from the same problem
 ;; as using a register class to describe this restriction.  Namely, it
index 57b008ea3795d7b6a003db4d6c2ccf1cc1d1a75a..159685d4226619c046b28073e6da3e029c711350 100644 (file)
@@ -675,6 +675,8 @@ static scalar_int_mode sparc_cstore_mode (enum insn_code icode);
 static void sparc_atomic_assign_expand_fenv (tree *, tree *, tree *);
 static bool sparc_fixed_condition_code_regs (unsigned int *, unsigned int *);
 static unsigned int sparc_min_arithmetic_precision (void);
+static bool sparc_hard_regno_mode_ok (unsigned int, machine_mode);
+
 \f
 #ifdef SUBTARGET_ATTRIBUTE_TABLE
 /* Table of valid machine attributes.  */
@@ -899,6 +901,9 @@ char sparc_hard_reg_printed[8];
 #undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS
 #define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 1
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK sparc_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 /* Return the memory reference contained in X if any, zero otherwise.  */
@@ -4974,7 +4979,7 @@ enum sparc_mode_class {
    registers can hold double-word quantities in 32-bit mode.  */
 
 /* This points to either the 32-bit or the 64-bit version.  */
-const int *hard_regno_mode_classes;
+static const int *hard_regno_mode_classes;
 
 static const int hard_32bit_mode_classes[] = {
   S_MODES, S_MODES, T_MODES, S_MODES, T_MODES, S_MODES, D_MODES, S_MODES,
@@ -5026,7 +5031,7 @@ static const int hard_64bit_mode_classes[] = {
   CC_MODES, 0, D_MODES
 };
 
-int sparc_mode_class [NUM_MACHINE_MODES];
+static int sparc_mode_class [NUM_MACHINE_MODES];
 
 enum reg_class sparc_regno_reg_class[FIRST_PSEUDO_REGISTER];
 
@@ -13122,10 +13127,22 @@ sparc_regmode_natural_size (machine_mode mode)
   return size;
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.
+
+   ??? Because of the funny way we pass parameters we should allow certain
+   ??? types of float/complex values to be in integer registers during
+   ??? RTL generation.  This only matters on arch32.  */
+
+static bool
+sparc_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return (hard_regno_mode_classes[regno] & sparc_mode_class[mode]) != 0;
+}
+
 /* Return TRUE if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be FALSE for correct output.
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be FALSE for correct output.
 
    For V9 we have to deal with the fact that only the lower 32 floating
    point registers are 32-bit addressable.  */
index 15a62179af57591c7197c68822f9aa31ca38a3ea..b4c3dab6646a76b5e727bac6c35f67626cf12e92 100644 (file)
@@ -768,17 +768,6 @@ extern enum cmodel sparc_cmodel;
    macro too.  */
 #define REGMODE_NATURAL_SIZE(MODE) sparc_regmode_natural_size (MODE)
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
-   See sparc.c for how we initialize this.  */
-extern const int *hard_regno_mode_classes;
-extern int sparc_mode_class[];
-
-/* ??? Because of the funny way we pass parameters we should allow certain
-   ??? types of float/complex values to be in integer registers during
-   ??? RTL generation.  This only matters on arch32.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
-  ((hard_regno_mode_classes[REGNO] & sparc_mode_class[MODE]) != 0)
-
 /* Value is 1 if it is OK to rename a hard register FROM to another hard
    register TO.  We cannot rename %g1 as it may be used before the save
    register window instruction in the prologue.  */
@@ -878,10 +867,10 @@ extern int sparc_mode_class[];
 
    For v9 we must distinguish between the upper and lower floating point
    registers because the upper ones can't hold SFmode values.
-   HARD_REGNO_MODE_OK won't help here because reload assumes that register(s)
-   satisfying a group need for a class will also satisfy a single need for
-   that class.  EXTRA_FP_REGS is a bit of a misnomer as it covers all 64 fp
-   regs.
+   TARGET_HARD_REGNO_MODE_OK won't help here because reload assumes that
+   register(s) satisfying a group need for a class will also satisfy a
+   single need for that class.  EXTRA_FP_REGS is a bit of a misnomer as
+   it covers all 64 fp regs.
 
    It is important that one class contains all the general and all the standard
    fp regs.  Otherwise find_reg() won't properly allocate int regs for moves,
index 5b1994d325ad59f88431ae20bc0a086240a1a79d..b2e0121cd141da837a0ee8be54f790497c703168 100644 (file)
@@ -176,8 +176,6 @@ extern GTY(()) int spu_tune;
 #define HARD_REGNO_NREGS(REGNO, MODE)   \
     ((GET_MODE_BITSIZE(MODE)+MAX_FIXED_MODE_SIZE-1)/MAX_FIXED_MODE_SIZE)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
 #define MODES_TIEABLE_P(MODE1, MODE2) \
   (GET_MODE_BITSIZE (MODE1) <= MAX_FIXED_MODE_SIZE \
    && GET_MODE_BITSIZE (MODE2) <= MAX_FIXED_MODE_SIZE)
index 1a362524e8d24a8bfc9578579c4f30c4010f6739..897d0e6f32c6b37076102105c9bd5eb80fd5e772 100644 (file)
@@ -2617,6 +2617,14 @@ xstormy16_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
   const HOST_WIDE_INT size = int_size_in_bytes (type);
   return (size == -1 || size > UNITS_PER_WORD * NUM_ARGUMENT_REGISTERS);
 }
+
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+xstormy16_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return regno != 16 || mode == BImode;
+}
 \f
 #undef  TARGET_ASM_ALIGNED_HI_OP
 #define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t"
@@ -2694,6 +2702,9 @@ xstormy16_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
 #undef TARGET_TRAMPOLINE_INIT
 #define TARGET_TRAMPOLINE_INIT xstormy16_trampoline_init
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK xstormy16_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-stormy16.h"
index 33849e85c8be47f3d86aaa8176907a50252d9cee..5ce2f34ba4a7b134c9cc9f368d923494ac952125 100644 (file)
 #define HARD_REGNO_NREGS(REGNO, MODE)                          \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE) ((REGNO) != 16 || (MODE) == BImode)
-
 /* A C expression that is nonzero if it is desirable to choose register
    allocation so as to avoid move instructions between a value of mode MODE1
    and a value of mode MODE2.
 
-   If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R, MODE2)' are
-   ever different for any R, then `MODES_TIEABLE_P (MODE1, MODE2)' must be
-   zero.  */
+   If `TARGET_HARD_REGNO_MODE_OK (R, MODE1)' and
+   `TARGET_HARD_REGNO_MODE_OK (R, MODE2)' are ever different for any R,
+   then `MODES_TIEABLE_P (MODE1, MODE2)' must be zero.  */
 #define MODES_TIEABLE_P(MODE1, MODE2) ((MODE1) != BImode && (MODE2) != BImode)
 
 \f
index 70b2266a2ce0e53b5fe7ef9d96c7a37e7de10320..d6793225cb6af52731db7f436ec8eab851c5e2b2 100644 (file)
 #define HARD_REGNO_NREGS(REGNO, MODE)  \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
 #define MODES_TIEABLE_P(MODE1, MODE2)  1
 
 /* Register that holds an address into the text segment that can be
index 819c42c87002626671e3f948a1b639b4691156eb..56186387d62ee98885d610a8c2b63a572e4b5918 100644 (file)
 #define HARD_REGNO_NREGS(REGNO, MODE)  \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* All registers can hold all modes.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
 #define MODES_TIEABLE_P(MODE1, MODE2)  1
 
 /* Register that holds an address into the text segment that can be
index ffdce9887744361c661c545ca9930ac3b677ef8f..4f932477648a1049068ab4832af852dd21299a7c 100644 (file)
@@ -3247,6 +3247,14 @@ v850_gen_movdi (rtx * operands)
   
   return "st.dw %1, %0";
 }
+
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+v850_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return GET_MODE_SIZE (mode) <= 4 || ((regno & 1) == 0 && regno != 0);
+}
 \f
 /* Initialize the GCC target structure.  */
 
@@ -3352,6 +3360,9 @@ v850_gen_movdi (rtx * operands)
 #undef  TARGET_CAN_USE_DOLOOP_P
 #define TARGET_CAN_USE_DOLOOP_P can_use_doloop_if_innermost
 
+#undef  TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK v850_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-v850.h"
index b51724ca3c10815ee4789be3bba84c79689262f5..de00cfe2c85bac31ec2dcc7d3dd3bbf99d9a3a77 100644 (file)
@@ -300,16 +300,10 @@ extern GTY(()) rtx v850_compare_op1;
 #define HARD_REGNO_NREGS(REGNO, MODE)   \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode
-   MODE.  */
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE) \
- ((GET_MODE_SIZE (MODE) <= 4) || (((REGNO) & 1) == 0 && (REGNO) != 0))
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.  */
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.  */
 #define MODES_TIEABLE_P(MODE1, MODE2) \
   (MODE1 == MODE2 || (GET_MODE_SIZE (MODE1) <= 4 && GET_MODE_SIZE (MODE2) <= 4))
 
index 1601ab6a97a0c18b7774b0533114c4795c4b576e..c8831e2f91ab5def7ae22bdb20c7a00512ad4cb9 100644 (file)
@@ -143,14 +143,10 @@ along with GCC; see the file COPYING3.  If not see
 #define HARD_REGNO_NREGS(REGNO, MODE)  \
   ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
-   On the VAX, all registers can hold all modes.  */
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.  */
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.  */
 #define MODES_TIEABLE_P(MODE1, MODE2)  1
 
 /* Specify the registers used for certain standard purposes.
index dcffe5c5fccc7c35e80b699bb12d44eb92491741..7d29f27c4947d745ce97e1a466516eb494c3b916 100644 (file)
@@ -228,6 +228,8 @@ static void visium_init_libfuncs (void);
 
 static unsigned int visium_reorg (void);
 
+static bool visium_hard_regno_mode_ok (unsigned int, machine_mode);
+
 /* Setup the global target hooks structure.  */
 
 #undef  TARGET_MAX_ANCHOR_OFFSET
@@ -339,6 +341,9 @@ static unsigned int visium_reorg (void);
 #undef TARGET_FLAGS_REGNUM
 #define TARGET_FLAGS_REGNUM FLAGS_REGNUM
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK visium_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 namespace {
@@ -836,6 +841,26 @@ visium_hard_regno_rename_ok (unsigned int from ATTRIBUTE_UNUSED,
   return 1;
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.
+
+   Modes with sizes which cross from the one register class to the
+   other cannot be allowed. Only single floats are allowed in the
+   floating point registers, and only fixed point values in the EAM
+   registers. */
+
+static bool
+visium_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  if (GP_REGISTER_P (regno))
+    return GP_REGISTER_P (regno + HARD_REGNO_NREGS (regno, mode) - 1);
+
+  if (FP_REGISTER_P (regno))
+    return mode == SFmode || (mode == SImode && TARGET_FPU_IEEE);
+
+  return (GET_MODE_CLASS (mode) == MODE_INT
+         && HARD_REGNO_NREGS (regno, mode) == 1);
+}
+
 /* Return true if it is ok to do sibling call optimization for the specified
    call expression EXP.  DECL will be the called function, or NULL if this
    is an indirect call.  */
index 1f055fa903cc0a7dd98961ecac93252b53fb81eb..6538bff4600d89f19b1f21874a50725f6199fb78 100644 (file)
 #define HARD_REGNO_RENAME_OK(OLD_REG, NEW_REG) \
   visium_hard_regno_rename_ok (OLD_REG, NEW_REG)
 
-/*  `HARD_REGNO_MODE_OK (REGNO, MODE)'
-
-    A C expression that is nonzero if it is permissible to store a
-    value of mode MODE in hard register number REGNO (or in several
-    registers starting with that one). 
-
-    Modes with sizes which cross from the one register class to the
-    other cannot be allowed. Only single floats are allowed in the
-    floating point registers, and only fixed point values in the EAM
-    registers. */
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                         \
- (GP_REGISTER_P (REGNO) ?                                       \
-     GP_REGISTER_P (REGNO + HARD_REGNO_NREGS (REGNO, MODE) - 1) \
-  : FP_REGISTER_P (REGNO) ?                                     \
-     (MODE) == SFmode || ((MODE) == SImode && TARGET_FPU_IEEE)  \
-  : GET_MODE_CLASS (MODE) == MODE_INT                           \
-    && HARD_REGNO_NREGS (REGNO, MODE) == 1)
-
 /* `MODES_TIEABLE_P (MODE1, MODE2)'
 
    A C expression that is nonzero if a value of mode MODE1 is
    accessible in mode MODE2 without copying.
 
-   If `HARD_REGNO_MODE_OK (R, MODE1)' and `HARD_REGNO_MODE_OK (R,
-   MODE2)' are always the same for any R, then `MODES_TIEABLE_P
-   (MODE1, MODE2)' should be nonzero.  If they differ for any R, you
-   should define this macro to return zero unless some other mechanism
-   ensures the accessibility of the value in a narrower mode.
+   If `TARGET_HARD_REGNO_MODE_OK (R, MODE1)' and
+   `TARGET_HARD_REGNO_MODE_OK (R, MODE2)' are always the same for any R,
+   then `MODES_TIEABLE_P (MODE1, MODE2)' should be nonzero.  If they
+   differ for any R, you should define this macro to return zero unless
+   some other mechanism ensures the accessibility of the value in a
+   narrower mode.
 
    You should define this macro to return nonzero in as many cases as
    possible since doing so will allow GNU CC to perform better
index 9950f3f3f7eaeb376debf61f3a0699db426c1b7d..31b0d49274ea5b77ad97f306818ee5b4c0c8a9aa 100644 (file)
 ;; mantissa) to a quiet NaN (-1). This is acceptable when the data to be
 ;; moved is in fact a floating-point number, but to avoid nasty surprises
 ;; integers must in general be kept out of the floating-point registers.
-;; HARD_REGNO_MODE_OK thus only allows SFmode in these registers.
+;; TARGET_HARD_REGNO_MODE_OK thus only allows SFmode in these registers.
 ;; However, since FTOI and ITOF use floating-point registers for both their
 ;; inputs and outputs, to use these instructions integers must transiently
 ;; occupy such registers. To disguise this from the compiler, UNSPECs are
index 9c94c59f48a204f1e43538b47d48aabab1e465c5..1d5fbcac459fe394ef0dd476f78637eb26738d09 100644 (file)
@@ -78,7 +78,8 @@ enum internal_test
 
 /* Array giving truth value on whether or not a given hard register
    can support a given mode.  */
-char xtensa_hard_regno_mode_ok[(int) MAX_MACHINE_MODE][FIRST_PSEUDO_REGISTER];
+static char xtensa_hard_regno_mode_ok_p
+  [(int) MAX_MACHINE_MODE][FIRST_PSEUDO_REGISTER];
 
 /* Largest block move to handle in-line.  */
 #define LARGEST_MOVE_RATIO 15
@@ -177,6 +178,7 @@ static bool xtensa_member_type_forces_blk (const_tree,
                                           machine_mode mode);
 
 static void xtensa_conditional_register_usage (void);
+static bool xtensa_hard_regno_mode_ok (unsigned int, machine_mode);
 
 \f
 
@@ -305,6 +307,9 @@ static void xtensa_conditional_register_usage (void);
 #undef TARGET_CONDITIONAL_REGISTER_USAGE
 #define TARGET_CONDITIONAL_REGISTER_USAGE xtensa_conditional_register_usage
 
+#undef TARGET_HARD_REGNO_MODE_OK
+#define TARGET_HARD_REGNO_MODE_OK xtensa_hard_regno_mode_ok
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 \f
@@ -2217,7 +2222,7 @@ xtensa_option_override (void)
          else
            temp = FALSE;
 
-         xtensa_hard_regno_mode_ok[(int) mode][regno] = temp;
+         xtensa_hard_regno_mode_ok_p[(int) mode][regno] = temp;
        }
     }
 
@@ -2252,6 +2257,14 @@ xtensa_option_override (void)
     }
 }
 
+/* Implement TARGET_HARD_REGNO_MODE_OK.  */
+
+static bool
+xtensa_hard_regno_mode_ok (unsigned int regno, machine_mode mode)
+{
+  return xtensa_hard_regno_mode_ok_p[mode][regno];
+}
+
 /* A C compound statement to output to stdio stream STREAM the
    assembler syntax for an instruction operand X.  X is an RTL
    expression.
index 06dc82cd070617741ebed7dfd53ffdfefb893b8f..2ec31ab596917d0f48233b1778199dc207662a4b 100644 (file)
@@ -328,17 +328,10 @@ extern int leaf_function;
        ((GET_MODE_SIZE (MODE) + UNITS_PER_FPREG - 1) / UNITS_PER_FPREG) : \
        ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))
 
-/* Value is 1 if hard register REGNO can hold a value of machine-mode
-   MODE.  */
-extern char xtensa_hard_regno_mode_ok[][FIRST_PSEUDO_REGISTER];
-
-#define HARD_REGNO_MODE_OK(REGNO, MODE)                                        \
-  xtensa_hard_regno_mode_ok[(int) (MODE)][(REGNO)]
-
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
-   If HARD_REGNO_MODE_OK could produce different values for MODE1 and MODE2,
-   for any hard reg, then this must be 0 for correct output.  */
+   If TARGET_HARD_REGNO_MODE_OK could produce different values for MODE1
+   and MODE2, for any hard reg, then this must be 0 for correct output.  */
 #define MODES_TIEABLE_P(MODE1, MODE2)                                  \
   ((GET_MODE_CLASS (MODE1) == MODE_FLOAT ||                            \
     GET_MODE_CLASS (MODE1) == MODE_COMPLEX_FLOAT)                      \
index ed78df818b2bbc4f83557ba93591a54b452c7142..14aab9474bc214d2e07a4a7ba74abfabb65e7cbe 100644 (file)
@@ -4731,7 +4731,7 @@ it is unsafe to call @code{gen_reg_rtx} to allocate a new pseudo.
 
 The constraints on a @samp{mov@var{m}} must permit moving any hard
 register to any other hard register provided that
-@code{HARD_REGNO_MODE_OK} permits mode @var{m} in both registers and
+@code{TARGET_HARD_REGNO_MODE_OK} permits mode @var{m} in both registers and
 @code{TARGET_REGISTER_MOVE_COST} applied to their classes returns a value
 of 2.
 
@@ -4744,7 +4744,7 @@ point members.
 There may also be a need to support fixed point @samp{mov@var{m}}
 instructions in and out of floating point registers.  Unfortunately, I
 have forgotten why this was so, and I don't know whether it is still
-true.  If @code{HARD_REGNO_MODE_OK} rejects fixed point values in
+true.  If @code{TARGET_HARD_REGNO_MODE_OK} rejects fixed point values in
 floating point registers, then the constraints of the fixed point
 @samp{mov@var{m}} instructions must be designed to avoid ever trying to
 reload into a floating point register.
index 0c77b533adbe1571e9e8936e00bc7be4bf7df4c1..35141acb6f0ce2081ecda038c79ccfed4bd12788 100644 (file)
@@ -2017,8 +2017,9 @@ consecutive registers are needed for a given mode.
 A C expression for the number of consecutive hard registers, starting
 at register number @var{regno}, required to hold a value of mode
 @var{mode}.  This macro must never return zero, even if a register
-cannot hold the requested mode - indicate that with HARD_REGNO_MODE_OK
-and/or CANNOT_CHANGE_MODE_CLASS instead.
+cannot hold the requested mode - indicate that with
+@code{TARGET_HARD_REGNO_MODE_OK} and/or @code{CANNOT_CHANGE_MODE_CLASS}
+instead.
 
 On a machine where all registers are exactly one word, a suitable
 definition of this macro is
@@ -2066,22 +2067,18 @@ happens for example on SPARC 64-bit where the natural size of
 floating-point registers is still 32-bit.
 @end defmac
 
-@defmac HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
-A C expression that is nonzero if it is permissible to store a value
+@deftypefn {Target Hook} bool TARGET_HARD_REGNO_MODE_OK (unsigned int @var{regno}, machine_mode @var{mode})
+This hook returns true if it is permissible to store a value
 of mode @var{mode} in hard register number @var{regno} (or in several
-registers starting with that one).  For a machine where all registers
-are equivalent, a suitable definition is
-
-@smallexample
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-@end smallexample
+registers starting with that one).  The default definition returns true
+unconditionally.
 
 You need not include code to check for the numbers of fixed registers,
 because the allocation mechanism considers them to be always occupied.
 
 @cindex register pairs
 On some machines, double-precision values must be kept in even/odd
-register pairs.  You can implement that by defining this macro to reject
+register pairs.  You can implement that by defining this hook to reject
 odd register numbers for such modes.
 
 The minimum requirement for a mode to be OK in a register is that the
@@ -2091,9 +2088,9 @@ value into the register and back out not alter it.
 
 Since the same instruction used to move @code{word_mode} will work for
 all narrower integer modes, it is not necessary on any machine for
-@code{HARD_REGNO_MODE_OK} to distinguish between these modes, provided
-you define patterns @samp{movhi}, etc., to take advantage of this.  This
-is useful because of the interaction between @code{HARD_REGNO_MODE_OK}
+this hook to distinguish between these modes, provided you define
+patterns @samp{movhi}, etc., to take advantage of this.  This is
+useful because of the interaction between @code{TARGET_HARD_REGNO_MODE_OK}
 and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes
 to be tieable.
 
@@ -2108,16 +2105,16 @@ On some machines, though, the converse is true: fixed-point machine
 modes may not go in floating registers.  This is true if the floating
 registers normalize any value stored in them, because storing a
 non-floating value there would garble it.  In this case,
-@code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
+@code{TARGET_HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
 floating registers.  But if the floating registers do not automatically
 normalize, if you can store any bit pattern in one and retrieve it
 unchanged without a trap, then any machine mode may go in a floating
-register, so you can define this macro to say so.
+register, so you can define this hook to say so.
 
 The primary significance of special floating registers is rather that
 they are the registers acceptable in floating point arithmetic
 instructions.  However, this is of no concern to
-@code{HARD_REGNO_MODE_OK}.  You handle it by writing the proper
+@code{TARGET_HARD_REGNO_MODE_OK}.  You handle it by writing the proper
 constraints for those instructions.
 
 On some machines, the floating registers are especially slow to access,
@@ -2125,7 +2122,7 @@ so that it is better to store a value in a stack frame than in such a
 register if floating point arithmetic is not being done.  As long as the
 floating registers are not in class @code{GENERAL_REGS}, they will not
 be used unless some pattern's constraint asks for one.
-@end defmac
+@end deftypefn
 
 @defmac HARD_REGNO_RENAME_OK (@var{from}, @var{to})
 A C expression that is nonzero if it is OK to rename a hard register
@@ -2142,9 +2139,9 @@ The default is always nonzero.
 A C expression that is nonzero if a value of mode
 @var{mode1} is accessible in mode @var{mode2} without copying.
 
-If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
-@code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same for
-any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})}
+If @code{TARGET_HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
+@code{TARGET_HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same
+for any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})}
 should be nonzero.  If they differ for any @var{r}, you should define
 this macro to return zero unless some other mechanism ensures the
 accessibility of the value in a narrower mode.
@@ -2331,7 +2328,7 @@ When a value occupying several consecutive registers is expected in a
 certain class, all the registers used must belong to that class.
 Therefore, register classes cannot be used to enforce a requirement for
 a register pair to start with an even-numbered register.  The way to
-specify this requirement is with @code{HARD_REGNO_MODE_OK}.
+specify this requirement is with @code{TARGET_HARD_REGNO_MODE_OK}.
 
 Register classes used for input-operands of bitwise-and or shift
 instructions have a special requirement: each such class must have, for
index 3fec545d8f9551e87ef9787a4e44bf958b1fb477..edcd9a2fa9d8c59c3255348d0d0a7893ab3c6f33 100644 (file)
@@ -1808,8 +1808,9 @@ consecutive registers are needed for a given mode.
 A C expression for the number of consecutive hard registers, starting
 at register number @var{regno}, required to hold a value of mode
 @var{mode}.  This macro must never return zero, even if a register
-cannot hold the requested mode - indicate that with HARD_REGNO_MODE_OK
-and/or CANNOT_CHANGE_MODE_CLASS instead.
+cannot hold the requested mode - indicate that with
+@code{TARGET_HARD_REGNO_MODE_OK} and/or @code{CANNOT_CHANGE_MODE_CLASS}
+instead.
 
 On a machine where all registers are exactly one word, a suitable
 definition of this macro is
@@ -1857,66 +1858,7 @@ happens for example on SPARC 64-bit where the natural size of
 floating-point registers is still 32-bit.
 @end defmac
 
-@defmac HARD_REGNO_MODE_OK (@var{regno}, @var{mode})
-A C expression that is nonzero if it is permissible to store a value
-of mode @var{mode} in hard register number @var{regno} (or in several
-registers starting with that one).  For a machine where all registers
-are equivalent, a suitable definition is
-
-@smallexample
-#define HARD_REGNO_MODE_OK(REGNO, MODE) 1
-@end smallexample
-
-You need not include code to check for the numbers of fixed registers,
-because the allocation mechanism considers them to be always occupied.
-
-@cindex register pairs
-On some machines, double-precision values must be kept in even/odd
-register pairs.  You can implement that by defining this macro to reject
-odd register numbers for such modes.
-
-The minimum requirement for a mode to be OK in a register is that the
-@samp{mov@var{mode}} instruction pattern support moves between the
-register and other hard register in the same class and that moving a
-value into the register and back out not alter it.
-
-Since the same instruction used to move @code{word_mode} will work for
-all narrower integer modes, it is not necessary on any machine for
-@code{HARD_REGNO_MODE_OK} to distinguish between these modes, provided
-you define patterns @samp{movhi}, etc., to take advantage of this.  This
-is useful because of the interaction between @code{HARD_REGNO_MODE_OK}
-and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes
-to be tieable.
-
-Many machines have special registers for floating point arithmetic.
-Often people assume that floating point machine modes are allowed only
-in floating point registers.  This is not true.  Any registers that
-can hold integers can safely @emph{hold} a floating point machine
-mode, whether or not floating arithmetic can be done on it in those
-registers.  Integer move instructions can be used to move the values.
-
-On some machines, though, the converse is true: fixed-point machine
-modes may not go in floating registers.  This is true if the floating
-registers normalize any value stored in them, because storing a
-non-floating value there would garble it.  In this case,
-@code{HARD_REGNO_MODE_OK} should reject fixed-point machine modes in
-floating registers.  But if the floating registers do not automatically
-normalize, if you can store any bit pattern in one and retrieve it
-unchanged without a trap, then any machine mode may go in a floating
-register, so you can define this macro to say so.
-
-The primary significance of special floating registers is rather that
-they are the registers acceptable in floating point arithmetic
-instructions.  However, this is of no concern to
-@code{HARD_REGNO_MODE_OK}.  You handle it by writing the proper
-constraints for those instructions.
-
-On some machines, the floating registers are especially slow to access,
-so that it is better to store a value in a stack frame than in such a
-register if floating point arithmetic is not being done.  As long as the
-floating registers are not in class @code{GENERAL_REGS}, they will not
-be used unless some pattern's constraint asks for one.
-@end defmac
+@hook TARGET_HARD_REGNO_MODE_OK
 
 @defmac HARD_REGNO_RENAME_OK (@var{from}, @var{to})
 A C expression that is nonzero if it is OK to rename a hard register
@@ -1933,9 +1875,9 @@ The default is always nonzero.
 A C expression that is nonzero if a value of mode
 @var{mode1} is accessible in mode @var{mode2} without copying.
 
-If @code{HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
-@code{HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same for
-any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})}
+If @code{TARGET_HARD_REGNO_MODE_OK (@var{r}, @var{mode1})} and
+@code{TARGET_HARD_REGNO_MODE_OK (@var{r}, @var{mode2})} are always the same
+for any @var{r}, then @code{MODES_TIEABLE_P (@var{mode1}, @var{mode2})}
 should be nonzero.  If they differ for any @var{r}, you should define
 this macro to return zero unless some other mechanism ensures the
 accessibility of the value in a narrower mode.
@@ -2114,7 +2056,7 @@ When a value occupying several consecutive registers is expected in a
 certain class, all the registers used must belong to that class.
 Therefore, register classes cannot be used to enforce a requirement for
 a register pair to start with an even-numbered register.  The way to
-specify this requirement is with @code{HARD_REGNO_MODE_OK}.
+specify this requirement is with @code{TARGET_HARD_REGNO_MODE_OK}.
 
 Register classes used for input-operands of bitwise-and or shift
 instructions have a special requirement: each such class must have, for
index e912e683bb0aa0755918b1de61d520b246cb390b..7fcf2f7eea45ebcf5eac421115057ca2adc6024c 100644 (file)
@@ -148,7 +148,7 @@ init_expr_target (void)
             && (direct_load[(int) mode] == 0 || direct_store[(int) mode] == 0);
             regno++)
          {
-           if (! HARD_REGNO_MODE_OK (regno, mode))
+           if (!targetm.hard_regno_mode_ok (regno, mode))
              continue;
 
            set_mode_and_regno (reg, mode, regno);
@@ -541,7 +541,7 @@ convert_mode_scalar (rtx to, rtx from, int unsignedp)
            || GET_CODE (from) == SUBREG))
        from = force_reg (from_mode, from);
       if (REG_P (from) && REGNO (from) < FIRST_PSEUDO_REGISTER
-         && ! HARD_REGNO_MODE_OK (REGNO (from), to_mode))
+         && !targetm.hard_regno_mode_ok (REGNO (from), to_mode))
        from = copy_to_reg (from);
       emit_move_insn (to, gen_lowpart (to_mode, from));
       return;
@@ -694,7 +694,7 @@ convert_modes (machine_mode mode, machine_mode oldmode, rtx x, int unsignedp)
       && ((MEM_P (x) && !MEM_VOLATILE_P (x) && direct_load[(int) int_mode])
           || (REG_P (x)
               && (!HARD_REGISTER_P (x)
-                  || HARD_REGNO_MODE_OK (REGNO (x), int_mode))
+                 || targetm.hard_regno_mode_ok (REGNO (x), int_mode))
               && TRULY_NOOP_TRUNCATION_MODES_P (int_mode, GET_MODE (x)))))
    return gen_lowpart (int_mode, x);
 
index 439a7f43927167ce464800b59a60a3d39619b2ba..48226f5d3ac267ed7801746e03729dbe36bd931d 100644 (file)
@@ -1581,7 +1581,8 @@ write_insn_preds_c (void)
 #include \"reload.h\"\n\
 #include \"regs.h\"\n\
 #include \"emit-rtl.h\"\n\
-#include \"tm-constrs.h\"\n");
+#include \"tm-constrs.h\"\n\
+#include \"target.h\"\n");
 
   FOR_ALL_PREDICATES (p)
     write_one_predicate_function (p);
index be23dec6217eb2bcb88ae214c8d7c31d4c45172f..7254e2ea4fc59fe043e989fe1656918aba099be6 100644 (file)
@@ -133,6 +133,13 @@ hook_bool_uint_mode_false (unsigned int, machine_mode)
   return false;
 }
 
+/* Generic hook that takes (unsigned int, machine_mode) and returns true.  */
+bool
+hook_bool_uint_mode_true (unsigned int, machine_mode)
+{
+  return true;
+}
+
 /* Generic hook that takes (FILE *, const char *) and does nothing.  */
 void
 hook_void_FILEptr_constcharptr (FILE *, const char *)
index b8f17f62d0021efac3e4048a31aeaa61f8c86615..632d3370a13e8cc3c843038343a9064979473cc7 100644 (file)
@@ -39,6 +39,7 @@ extern bool hook_bool_const_rtx_insn_const_rtx_insn_true (const rtx_insn *,
 extern bool hook_bool_mode_uhwi_false (machine_mode,
                                       unsigned HOST_WIDE_INT);
 extern bool hook_bool_uint_mode_false (unsigned int, machine_mode);
+extern bool hook_bool_uint_mode_true (unsigned int, machine_mode);
 extern bool hook_bool_tree_false (tree);
 extern bool hook_bool_const_tree_false (const_tree);
 extern bool hook_bool_tree_true (tree);
index 08a1cc550b24ff31375fa9ecaf6bb3dd7d9065ba..df7a3838a6efc64474c349a821f86f1296607b50 100644 (file)
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -1508,7 +1508,7 @@ setup_prohibited_class_mode_regs (void)
          for (k = ira_class_hard_regs_num[cl] - 1; k >= 0; k--)
            {
              hard_regno = ira_class_hard_regs[cl][k];
-             if (! HARD_REGNO_MODE_OK (hard_regno, (machine_mode) j))
+             if (!targetm.hard_regno_mode_ok (hard_regno, (machine_mode) j))
                SET_HARD_REG_BIT (ira_prohibited_class_mode_regs[cl][j],
                                  hard_regno);
              else if (in_hard_reg_set_p (temp_hard_regset,
@@ -1754,7 +1754,7 @@ setup_prohibited_mode_move_regs (void)
       SET_HARD_REG_SET (ira_prohibited_mode_move_regs[i]);
       for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
        {
-         if (! HARD_REGNO_MODE_OK (j, (machine_mode) i))
+         if (!targetm.hard_regno_mode_ok (j, (machine_mode) i))
            continue;
          set_mode_and_regno (test_reg1, (machine_mode) i, j);
          set_mode_and_regno (test_reg2, (machine_mode) i, j);
index 667cfdc9b0982dc1a648fc226a08a6248c9060b6..69021c4ac74b3a75b88ca9c863ce1ff479d60b5e 100644 (file)
--- a/gcc/ira.h
+++ b/gcc/ira.h
@@ -114,8 +114,8 @@ struct target_ira
   HARD_REG_SET x_ira_no_alloc_regs;
 
   /* Array whose values are hard regset of hard registers available for
-     the allocation of given register class whose HARD_REGNO_MODE_OK
-     values for given mode are zero.  */
+     the allocation of given register class whose targetm.hard_regno_mode_ok
+     values for given mode are false.  */
   HARD_REG_SET x_ira_prohibited_class_mode_regs[N_REG_CLASSES][NUM_MACHINE_MODES];
 };
 
index 2aadeefb21457b504e8df7b48f160944cfbb6845..ca458ff2df0b7417903d59df4d8bad0ba645a87a 100644 (file)
@@ -640,7 +640,8 @@ find_hard_regno_for_1 (int regno, int *cost, int try_only_hard_regno,
        hard_regno = ira_class_hard_regs[rclass][i];
       if (! overlaps_hard_reg_set_p (conflict_set,
                                     PSEUDO_REGNO_MODE (regno), hard_regno)
-         && HARD_REGNO_MODE_OK (hard_regno, PSEUDO_REGNO_MODE (regno))
+         && targetm.hard_regno_mode_ok (hard_regno,
+                                        PSEUDO_REGNO_MODE (regno))
          /* We can not use prohibited_class_mode_regs for all classes
             because it is not defined for all classes.  */
          && (ira_allocno_class_translate[rclass] != rclass
index 221642ed3a6d1c29fa8bde8ec577eacc0c4b1e7e..ca9fb1169d9cba660d269566299ceaf50b7afee1 100644 (file)
@@ -2416,7 +2416,7 @@ process_alt_operands (int only_alternative)
                {
                  int i;
                  for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-                   if (HARD_REGNO_MODE_OK (i, mode)
+                   if (targetm.hard_regno_mode_ok (i, mode)
                        && in_hard_reg_set_p (reg_class_contents[this_alternative],
                                              mode, i))
                      break;
@@ -2528,10 +2528,9 @@ process_alt_operands (int only_alternative)
                      && hard_regno[nop] < 0
                      && GET_CODE (*curr_id->operand_loc[nop]) == SUBREG
                      && ira_class_hard_regs_num[this_alternative] > 0
-                     && ! HARD_REGNO_MODE_OK (ira_class_hard_regs
-                                              [this_alternative][0],
-                                              GET_MODE
-                                              (*curr_id->operand_loc[nop])))
+                     && (!targetm.hard_regno_mode_ok
+                         (ira_class_hard_regs[this_alternative][0],
+                          GET_MODE (*curr_id->operand_loc[nop]))))
                    {
                      if (lra_dump_file != NULL)
                        fprintf
@@ -2615,9 +2614,9 @@ process_alt_operands (int only_alternative)
                     more one general reg).  Therefore we have 2
                     conditions to check that the reload pseudo can
                     not hold the mode value.  */
-                 && ! HARD_REGNO_MODE_OK (ira_class_hard_regs
-                                          [this_alternative][0],
-                                          GET_MODE (*curr_id->operand_loc[nop]))
+                 && (!targetm.hard_regno_mode_ok
+                     (ira_class_hard_regs[this_alternative][0],
+                      GET_MODE (*curr_id->operand_loc[nop])))
                  /* The above condition is not enough as the first
                     reg in ira_class_hard_regs can be not aligned for
                     multi-words mode values.  */
@@ -5519,7 +5518,7 @@ split_reg (bool before_p, int original_regno, rtx_insn *insn,
         mode used for each independent register may not be supported
         so reject the split.  Splitting the wider mode should theoretically
         be possible but is not implemented.  */
-      if (! HARD_REGNO_MODE_OK (hard_regno, mode))
+      if (!targetm.hard_regno_mode_ok (hard_regno, mode))
        {
          if (lra_dump_file != NULL)
            {
index 4a54e88f5e8b0c76a99865536592c0f39dad396e..87dacd8f48d0931c812472c679796dda3d9f4136 100644 (file)
@@ -3159,7 +3159,7 @@ peep2_find_free_register (int from, int to, const char *class_str,
 #endif
 
       /* Can it support the mode we need?  */
-      if (! HARD_REGNO_MODE_OK (regno, mode))
+      if (!targetm.hard_regno_mode_ok (regno, mode))
        continue;
 
       success = 1;
index bffb18b2b0a9416d9fb72d71c1a861d15dceae24..72564de98af8b07b4d3fa3dfaa2828691f34e644 100644 (file)
--- a/gcc/ree.c
+++ b/gcc/ree.c
@@ -819,7 +819,7 @@ combine_reaching_defs (ext_cand *cand, const_rtx set_pat, ext_state *state)
 
       /* Ensure we can use the src_reg in dst_mode (needed for
         the (set (reg1) (reg2)) insn mentioned above).  */
-      if (!HARD_REGNO_MODE_OK (REGNO (src_reg), dst_mode))
+      if (!targetm.hard_regno_mode_ok (REGNO (src_reg), dst_mode))
        return false;
 
       /* Ensure the number of hard registers of the copy match.  */
index 40307b01fb2da6c60ca2fda9bb32771289e29724..1161f157d8e2ff45331984b0820766823b6cea98 100644 (file)
@@ -420,7 +420,7 @@ maybe_mode_change (machine_mode orig_mode, machine_mode copy_mode,
       offset = ((WORDS_BIG_ENDIAN ? wordoffset : 0)
                + (BYTES_BIG_ENDIAN ? byteoffset : 0));
       regno += subreg_regno_offset (regno, orig_mode, offset, new_mode);
-      if (HARD_REGNO_MODE_OK (regno, new_mode))
+      if (targetm.hard_regno_mode_ok (regno, new_mode))
        return gen_raw_REG (new_mode, regno);
     }
   return NULL_RTX;
index 970cbb61e0df2173f719d16ccaa807a3076557ce..6f699eb0fb7c0cae152d27698da4803ae852d4a5 100644 (file)
@@ -473,7 +473,7 @@ init_reg_sets_1 (void)
       CLEAR_HARD_REG_SET (ok_regs2);
       for (j = 0; j < FIRST_PSEUDO_REGISTER; j++)
        if (!TEST_HARD_REG_BIT (fixed_nonglobal_reg_set, j)
-           && HARD_REGNO_MODE_OK (j, (machine_mode) m))
+           && targetm.hard_regno_mode_ok (j, (machine_mode) m))
          {
            SET_HARD_REG_BIT (ok_regs, j);
            if (!fixed_regs[j])
@@ -634,7 +634,7 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED,
 
   FOR_EACH_MODE_IN_CLASS (mode, MODE_INT)
     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-       && HARD_REGNO_MODE_OK (regno, mode)
+       && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
            || !targetm.hard_regno_call_part_clobbered (regno, mode))
        && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
@@ -642,7 +642,7 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED,
 
   FOR_EACH_MODE_IN_CLASS (mode, MODE_FLOAT)
     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-       && HARD_REGNO_MODE_OK (regno, mode)
+       && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
            || !targetm.hard_regno_call_part_clobbered (regno, mode))
        && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
@@ -650,7 +650,7 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED,
 
   FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_FLOAT)
     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-       && HARD_REGNO_MODE_OK (regno, mode)
+       && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
            || !targetm.hard_regno_call_part_clobbered (regno, mode))
        && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
@@ -658,7 +658,7 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED,
 
   FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_INT)
     if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-       && HARD_REGNO_MODE_OK (regno, mode)
+       && targetm.hard_regno_mode_ok (regno, mode)
        && (!call_saved
            || !targetm.hard_regno_call_part_clobbered (regno, mode))
        && GET_MODE_SIZE (mode) > GET_MODE_SIZE (found_mode))
@@ -672,7 +672,7 @@ choose_hard_reg_mode (unsigned int regno ATTRIBUTE_UNUSED,
     {
       mode = (machine_mode) m;
       if ((unsigned) hard_regno_nregs[regno][mode] == nregs
-         && HARD_REGNO_MODE_OK (regno, mode)
+         && targetm.hard_regno_mode_ok (regno, mode)
          && (!call_saved
              || !targetm.hard_regno_call_part_clobbered (regno, mode)))
        return mode;
@@ -1238,7 +1238,7 @@ simplifiable_subregs (const subreg_shape &shape)
     {
       simplifiable_subreg *info = new simplifiable_subreg (shape);
       for (unsigned int i = 0; i < FIRST_PSEUDO_REGISTER; ++i)
-       if (HARD_REGNO_MODE_OK (i, shape.inner_mode)
+       if (targetm.hard_regno_mode_ok (i, shape.inner_mode)
            && simplify_subreg_regno (i, shape.inner_mode, shape.offset,
                                      shape.outer_mode) >= 0)
          SET_HARD_REG_BIT (info->simplifiable_regs, i);
index ff5f3e2efe903254266953e3310da9a4857c6808..9c196a1082db41747dd7bbf107c65a859f15e339 100644 (file)
@@ -335,7 +335,7 @@ check_new_reg_p (int reg ATTRIBUTE_UNUSED, int new_reg,
   /* See whether it accepts all modes that occur in
      definition and uses.  */
   for (tmp = this_head->first; tmp; tmp = tmp->next_use)
-    if ((! HARD_REGNO_MODE_OK (new_reg, GET_MODE (*tmp->loc))
+    if ((!targetm.hard_regno_mode_ok (new_reg, GET_MODE (*tmp->loc))
         && ! DEBUG_INSN_P (tmp->insn))
        || (this_head->need_caller_save_reg
            && ! (targetm.hard_regno_call_part_clobbered
index ee4798d07081abaa8a40b0db4475d07642cb7baa..f10a88b3e90c03cd823cb948deb767d4d9397e2b 100644 (file)
@@ -667,11 +667,11 @@ find_valid_class (machine_mode outer ATTRIBUTE_UNUSED,
       for (regno = 0; regno < FIRST_PSEUDO_REGISTER - n && ! bad; regno++)
        if (TEST_HARD_REG_BIT (reg_class_contents[rclass], regno))
          {
-           if (HARD_REGNO_MODE_OK (regno, inner))
+           if (targetm.hard_regno_mode_ok (regno, inner))
              {
                good = 1;
                if (TEST_HARD_REG_BIT (reg_class_contents[rclass], regno + n)
-                   && ! HARD_REGNO_MODE_OK (regno + n, outer))
+                   && !targetm.hard_regno_mode_ok (regno + n, outer))
                  bad = 1;
              }
          }
@@ -720,7 +720,7 @@ find_valid_class_1 (machine_mode outer ATTRIBUTE_UNUSED,
       for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
         {
           if (in_hard_reg_set_p (reg_class_contents[rclass], mode, regno)
-              && (HARD_REGNO_MODE_OK (regno, mode)))
+             && targetm.hard_regno_mode_ok (regno, mode))
             computed_rclass_size++;
         }
 
@@ -850,7 +850,7 @@ reload_inner_reg_of_subreg (rtx x, machine_mode mode, bool output)
     return false;
 
   /* If INNER is not ok for MODE, then INNER will need reloading.  */
-  if (!HARD_REGNO_MODE_OK (subreg_regno (x), mode))
+  if (!targetm.hard_regno_mode_ok (subreg_regno (x), mode))
     return true;
 
   /* If this is for an output, and the outer part is a word or smaller,
@@ -1087,7 +1087,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
                        / UNITS_PER_WORD)
                       != (int) hard_regno_nregs[REGNO (SUBREG_REG (in))]
                                                [GET_MODE (SUBREG_REG (in))]))
-                 || ! HARD_REGNO_MODE_OK (subreg_regno (in), inmode)))
+                 || !targetm.hard_regno_mode_ok (subreg_regno (in), inmode)))
          || (secondary_reload_class (1, rclass, inmode, in) != NO_REGS
              && (secondary_reload_class (1, rclass, GET_MODE (SUBREG_REG (in)),
                                          SUBREG_REG (in))
@@ -1181,7 +1181,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
              && ! (GET_MODE_SIZE (outmode) <= UNITS_PER_WORD
                    && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))
                        > UNITS_PER_WORD))
-             && ! HARD_REGNO_MODE_OK (subreg_regno (out), outmode))
+             && !targetm.hard_regno_mode_ok (subreg_regno (out), outmode))
          || (secondary_reload_class (0, rclass, outmode, out) != NO_REGS
              && (secondary_reload_class (0, rclass, GET_MODE (SUBREG_REG (out)),
                                          SUBREG_REG (out))
@@ -1310,7 +1310,7 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
            outmode = word_mode;
        }
       for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
-       if (HARD_REGNO_MODE_OK (i, mode)
+       if (targetm.hard_regno_mode_ok (i, mode)
            && in_hard_reg_set_p (reg_class_contents[(int) rclass], mode, i))
          break;
       if (i == FIRST_PSEUDO_REGISTER)
@@ -1621,8 +1621,8 @@ push_reload (rtx in, rtx out, rtx *inloc, rtx *outloc,
            /* Make sure the operand fits in the reg that dies.  */
            && (GET_MODE_SIZE (rel_mode)
                <= GET_MODE_SIZE (GET_MODE (XEXP (note, 0))))
-           && HARD_REGNO_MODE_OK (regno, inmode)
-           && HARD_REGNO_MODE_OK (regno, outmode))
+           && targetm.hard_regno_mode_ok (regno, inmode)
+           && targetm.hard_regno_mode_ok (regno, outmode))
          {
            unsigned int offs;
            unsigned int nregs = MAX (hard_regno_nregs[regno][inmode],
@@ -1902,7 +1902,7 @@ combine_reloads (void)
        && !reg_overlap_mentioned_for_reload_p (XEXP (note, 0),
                                                rld[output_reload].out)
        && (regno = REGNO (XEXP (note, 0))) < FIRST_PSEUDO_REGISTER
-       && HARD_REGNO_MODE_OK (regno, rld[output_reload].outmode)
+       && targetm.hard_regno_mode_ok (regno, rld[output_reload].outmode)
        && TEST_HARD_REG_BIT (reg_class_contents[(int) rld[output_reload].rclass],
                              regno)
        && (hard_regno_nregs[regno][rld[output_reload].outmode]
@@ -2026,7 +2026,7 @@ find_dummy_reload (rtx real_in, rtx real_out, rtx *inloc, rtx *outloc,
       *inloc = const0_rtx;
 
       if (regno < FIRST_PSEUDO_REGISTER
-         && HARD_REGNO_MODE_OK (regno, outmode)
+         && targetm.hard_regno_mode_ok (regno, outmode)
          && ! refers_to_regno_for_reload_p (regno, regno + nwords,
                                             PATTERN (this_insn), outloc))
        {
@@ -2063,13 +2063,13 @@ find_dummy_reload (rtx real_in, rtx real_out, rtx *inloc, rtx *outloc,
          || find_reg_note (this_insn, REG_UNUSED, real_out))
       && find_reg_note (this_insn, REG_DEAD, real_in)
       && !fixed_regs[REGNO (in)]
-      && HARD_REGNO_MODE_OK (REGNO (in),
-                            /* The only case where out and real_out might
-                               have different modes is where real_out
-                               is a subreg, and in that case, out
-                               has a real mode.  */
-                            (GET_MODE (out) != VOIDmode
-                             ? GET_MODE (out) : outmode))
+      && targetm.hard_regno_mode_ok (REGNO (in),
+                                    /* The only case where out and real_out
+                                       might have different modes is where
+                                       real_out is a subreg, and in that
+                                       case, out has a real mode.  */
+                                    (GET_MODE (out) != VOIDmode
+                                     ? GET_MODE (out) : outmode))
       && (ORIGINAL_REGNO (in) < FIRST_PSEUDO_REGISTER
          /* However only do this if we can be sure that this input
             operand doesn't correspond with an uninitialized pseudo.
@@ -4574,7 +4574,7 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
 
        if (regno < FIRST_PSEUDO_REGISTER
            && TEST_HARD_REG_BIT (reg_class_contents[rld[i].rclass], regno)
-           && HARD_REGNO_MODE_OK (regno, rld[i].mode))
+           && targetm.hard_regno_mode_ok (regno, rld[i].mode))
          {
            int nr = hard_regno_nregs[regno][rld[i].mode];
            int ok = 1, nri;
index d1ac40a25b43173ee6ce699e112a022ef73b03b2..648434b7b64bdab975b22330a67a17653d5b7ede 100644 (file)
@@ -1845,7 +1845,7 @@ find_reg (struct insn_chain *chain, int order)
 
       if (! TEST_HARD_REG_BIT (not_usable, regno)
          && ! TEST_HARD_REG_BIT (used_by_other_reload, regno)
-         && HARD_REGNO_MODE_OK (regno, rl->mode))
+         && targetm.hard_regno_mode_ok (regno, rl->mode))
        {
          int this_cost = spill_cost[regno];
          int ok = 1;
@@ -6099,9 +6099,7 @@ failed_reload (rtx_insn *insn, int r)
 static int
 set_reload_reg (int i, int r)
 {
-  /* regno is 'set but not used' if HARD_REGNO_MODE_OK doesn't use its first
-     parameter.  */
-  int regno ATTRIBUTE_UNUSED;
+  int regno;
   rtx reg = spill_reg_rtx[i];
 
   if (reg == 0 || GET_MODE (reg) != rld[r].mode)
@@ -6112,7 +6110,7 @@ set_reload_reg (int i, int r)
 
   /* Detect when the reload reg can't hold the reload mode.
      This used to be one `if', but Sequent compiler can't handle that.  */
-  if (HARD_REGNO_MODE_OK (regno, rld[r].mode))
+  if (targetm.hard_regno_mode_ok (regno, rld[r].mode))
     {
       machine_mode test_mode = VOIDmode;
       if (rld[r].in)
@@ -6124,9 +6122,9 @@ set_reload_reg (int i, int r)
         to reload from or into have modes which are valid for this
         reload register.  Otherwise the reload insns would be invalid.  */
       if (! (rld[r].in != 0 && test_mode != VOIDmode
-            && ! HARD_REGNO_MODE_OK (regno, test_mode)))
+            && !targetm.hard_regno_mode_ok (regno, test_mode)))
        if (! (rld[r].out != 0
-              && ! HARD_REGNO_MODE_OK (regno, GET_MODE (rld[r].out))))
+              && !targetm.hard_regno_mode_ok (regno, GET_MODE (rld[r].out))))
          {
            /* The reg is OK.  */
            last_spill_reg = i;
@@ -6217,7 +6215,7 @@ allocate_reload_reg (struct insn_chain *chain ATTRIBUTE_UNUSED, int r,
                                        rld[r].when_needed, rld[r].in,
                                        rld[r].out, r, 1)))
              && TEST_HARD_REG_BIT (reg_class_contents[rclass], regnum)
-             && HARD_REGNO_MODE_OK (regnum, rld[r].mode)
+             && targetm.hard_regno_mode_ok (regnum, rld[r].mode)
              /* Look first for regs to share, then for unshared.  But
                 don't share regs used for inherited reloads; they are
                 the ones we want to preserve.  */
@@ -6587,7 +6585,7 @@ choose_reload_regs (struct insn_chain *chain)
 
                  if (reg_reloaded_contents[i] == regno
                      && TEST_HARD_REG_BIT (reg_reloaded_valid, i)
-                     && HARD_REGNO_MODE_OK (i, rld[r].mode)
+                     && targetm.hard_regno_mode_ok (i, rld[r].mode)
                      && (TEST_HARD_REG_BIT (reg_class_contents[(int) rclass], i)
                          /* Even if we can't use this register as a reload
                             register, we might use it for reload_override_in,
@@ -6771,7 +6769,8 @@ choose_reload_regs (struct insn_chain *chain)
                    equiv = 0;
                }
 
-             if (equiv != 0 && ! HARD_REGNO_MODE_OK (regno, rld[r].mode))
+             if (equiv != 0
+                 && !targetm.hard_regno_mode_ok (regno, rld[r].mode))
                equiv = 0;
 
              /* We found a register that contains the value we need.
@@ -7152,7 +7151,7 @@ reload_adjust_reg_for_temp (rtx *reload_reg, rtx alt_reload_reg,
        continue;
       if (GET_MODE (reg) != new_mode)
        {
-         if (!HARD_REGNO_MODE_OK (regno, new_mode))
+         if (!targetm.hard_regno_mode_ok (regno, new_mode))
            continue;
          if (hard_regno_nregs[regno][new_mode]
              > hard_regno_nregs[regno][GET_MODE (reg)])
index 3ae06e42797fb9a9e7f4cacfdd2439f65dde5466..2029528a02dad4933626b2c4fcf4b26f3c02c190 100644 (file)
@@ -3635,8 +3635,8 @@ subreg_size_offset_from_lsb (unsigned int outer_bytes,
    function does not check whether adding INFO->offset to XREGNO gives
    a valid hard register; even if INFO->offset + XREGNO is out of range,
    there might be another register of the same type that is in range.
-   Likewise it doesn't check whether HARD_REGNO_MODE_OK accepts the new
-   register, since that can depend on things like whether the final
+   Likewise it doesn't check whether targetm.hard_regno_mode_ok accepts
+   the new register, since that can depend on things like whether the final
    register number is even or odd.  Callers that want to check whether
    this particular subreg can be replaced by a simple (reg ...) should
    use simplify_subreg_regno.  */
@@ -3901,8 +3901,8 @@ simplify_subreg_regno (unsigned int xregno, machine_mode xmode,
      ??? We allow invalid registers if (reg:XMODE XREGNO) is also invalid.
      This is a kludge to work around how complex FP arguments are passed
      on IA-64 and should be fixed.  See PR target/49226.  */
-  if (!HARD_REGNO_MODE_OK (yregno, ymode)
-      && HARD_REGNO_MODE_OK (xregno, xmode))
+  if (!targetm.hard_regno_mode_ok (yregno, ymode)
+      && targetm.hard_regno_mode_ok (xregno, xmode))
     return -1;
 
   return (int) yregno;
index b504b5d1482e9f6e22ce3bab41762ea78aa43f9e..92c0c6572b6a3725621ff82462749cf489b7cbf6 100644 (file)
@@ -1076,7 +1076,7 @@ init_regs_for_mode (machine_mode mode)
 
       /* See whether it accepts all modes that occur in
          original insns.  */
-      if (! HARD_REGNO_MODE_OK (cur_reg, mode))
+      if (!targetm.hard_regno_mode_ok (cur_reg, mode))
         continue;
 
       nregs = hard_regno_nregs[cur_reg][mode];
index 4eea495f00b20ef5c4a5e84d7d4ee263307fe3a8..8feaffed27d191b666a92662d265becef2deb102 100644 (file)
@@ -911,7 +911,7 @@ extern void fancy_abort (const char *, int, const char *)
        LIBGCC2_HAS_DF_MODE LIBGCC2_HAS_XF_MODE LIBGCC2_HAS_TF_MODE     \
        CLEAR_BY_PIECES_P MOVE_BY_PIECES_P SET_BY_PIECES_P              \
        STORE_BY_PIECES_P TARGET_FLT_EVAL_METHOD                        \
-       HARD_REGNO_CALL_PART_CLOBBERED
+       HARD_REGNO_CALL_PART_CLOBBERED HARD_REGNO_MODE_OK
 
 /* Target macros only used for code built for the target, that have
    moved to libgcc-tm.h or have never been present elsewhere.  */
index 689c0a03ef0c1ae6d4c422d26fa360dc09ebca0b..ca9dc87b54288d5af3f1bb2c2eb7d2626da76d33 100644 (file)
@@ -5381,6 +5381,65 @@ that are not actually in any insns yet, but will be later.",
  void, (void),
  hook_void_void)
 
+DEFHOOK
+(hard_regno_mode_ok,
+ "This hook returns true if it is permissible to store a value\n\
+of mode @var{mode} in hard register number @var{regno} (or in several\n\
+registers starting with that one).  The default definition returns true\n\
+unconditionally.\n\
+\n\
+You need not include code to check for the numbers of fixed registers,\n\
+because the allocation mechanism considers them to be always occupied.\n\
+\n\
+@cindex register pairs\n\
+On some machines, double-precision values must be kept in even/odd\n\
+register pairs.  You can implement that by defining this hook to reject\n\
+odd register numbers for such modes.\n\
+\n\
+The minimum requirement for a mode to be OK in a register is that the\n\
+@samp{mov@var{mode}} instruction pattern support moves between the\n\
+register and other hard register in the same class and that moving a\n\
+value into the register and back out not alter it.\n\
+\n\
+Since the same instruction used to move @code{word_mode} will work for\n\
+all narrower integer modes, it is not necessary on any machine for\n\
+this hook to distinguish between these modes, provided you define\n\
+patterns @samp{movhi}, etc., to take advantage of this.  This is\n\
+useful because of the interaction between @code{TARGET_HARD_REGNO_MODE_OK}\n\
+and @code{MODES_TIEABLE_P}; it is very desirable for all integer modes\n\
+to be tieable.\n\
+\n\
+Many machines have special registers for floating point arithmetic.\n\
+Often people assume that floating point machine modes are allowed only\n\
+in floating point registers.  This is not true.  Any registers that\n\
+can hold integers can safely @emph{hold} a floating point machine\n\
+mode, whether or not floating arithmetic can be done on it in those\n\
+registers.  Integer move instructions can be used to move the values.\n\
+\n\
+On some machines, though, the converse is true: fixed-point machine\n\
+modes may not go in floating registers.  This is true if the floating\n\
+registers normalize any value stored in them, because storing a\n\
+non-floating value there would garble it.  In this case,\n\
+@code{TARGET_HARD_REGNO_MODE_OK} should reject fixed-point machine modes in\n\
+floating registers.  But if the floating registers do not automatically\n\
+normalize, if you can store any bit pattern in one and retrieve it\n\
+unchanged without a trap, then any machine mode may go in a floating\n\
+register, so you can define this hook to say so.\n\
+\n\
+The primary significance of special floating registers is rather that\n\
+they are the registers acceptable in floating point arithmetic\n\
+instructions.  However, this is of no concern to\n\
+@code{TARGET_HARD_REGNO_MODE_OK}.  You handle it by writing the proper\n\
+constraints for those instructions.\n\
+\n\
+On some machines, the floating registers are especially slow to access,\n\
+so that it is better to store a value in a stack frame than in such a\n\
+register if floating point arithmetic is not being done.  As long as the\n\
+floating registers are not in class @code{GENERAL_REGS}, they will not\n\
+be used unless some pattern's constraint asks for one.",
+ bool, (unsigned int regno, machine_mode mode),
+ hook_bool_uint_mode_true)
+
 /* Return true if is OK to use a hard register REGNO as scratch register
    in peephole2.  */
 DEFHOOK
index d38d2c2721b1f44927fbdbe966b7fe3b4b5911bc..476efcfb786fc19166b6b5ffb7f6f6c59b5ecfdd 100644 (file)
@@ -1387,7 +1387,7 @@ make_decl_rtl (tree decl)
       else if (!in_hard_reg_set_p (operand_reg_set, mode, reg_number))
        error ("the register specified for %q+D is not general enough"
               " to be used as a register variable", decl);
-      else if (!HARD_REGNO_MODE_OK (reg_number, mode))
+      else if (!targetm.hard_regno_mode_ok (reg_number, mode))
        error ("register specified for %q+D isn%'t suitable for data type",
                decl);
       /* Now handle properly declared static register variables.  */