aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/ia64
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2017-09-12 13:29:36 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2017-09-12 13:29:36 +0000
commitc43f427972be6aecd3c85b854cdf601feb816316 (patch)
tree9e61c07e12b26365023f6656a4c2db2243dc73f2 /gcc/config/ia64
parenta93072ca5fd144dd0711b6225473080db4196793 (diff)
downloadgcc-c43f427972be6aecd3c85b854cdf601feb816316.zip
gcc-c43f427972be6aecd3c85b854cdf601feb816316.tar.gz
gcc-c43f427972be6aecd3c85b854cdf601feb816316.tar.bz2
Turn HARD_REGNO_NREGS into a target hook
2017-09-12 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * target.def (hard_regno_nregs): New hook. (class_max_nregs): Refer to it instead of HARD_REGNO_NREGS. * targhooks.h (default_hard_regno_nregs): Declare. * targhooks.c (default_hard_regno_nregs): New function. * doc/tm.texi.in (HARD_REGNO_NREGS): Replace with... (TARGET_HARD_REGNO_NREGS): ...this hook. (HARD_REGNO_NREGS_HAS_PADDING): Update accordingly. (CLASS_MAX_NREGS): Likewise. * doc/tm.texi: Regenerate. * reginfo.c (init_reg_modes_target): Use targetm.hard_regno_nregs instead of HARD_REGNO_NREGS. * rtl.h (REG_NREGS): Refer to TARGET_HARD_REGNO_NREGS rather than HARD_REGNO_NREGS in the comment. * config/aarch64/aarch64.h (HARD_REGNO_NREGS): Delete. * config/aarch64/aarch64-protos.h (aarch64_hard_regno_nregs): Delete. * config/aarch64/aarch64.c (aarch64_hard_regno_nregs): Make static. Return an unsigned int. (TARGET_HARD_REGNO_NREGS): Redefine. * config/alpha/alpha.h (HARD_REGNO_NREGS): Delete. * config/arc/arc.h (HARD_REGNO_NREGS): Delete. * config/arc/arc.c (TARGET_HARD_REGNO_NREGS): Redefine. (arc_hard_regno_nregs): New function. * config/arm/arm.h (HARD_REGNO_NREGS): Delete. * config/arm/arm.c (TARGET_HARD_REGNO_NREGS): Redefine. (arm_hard_regno_nregs): New function. * config/avr/avr.h (HARD_REGNO_NREGS): Delete. * config/bfin/bfin.h (HARD_REGNO_NREGS): Delete. * config/bfin/bfin.c (bfin_hard_regno_nregs): New function. (TARGET_HARD_REGNO_NREGS): Redefine. * config/c6x/c6x.h (HARD_REGNO_NREGS): Delete. * config/cr16/cr16.h (LONG_REG_P): Use targetm.hard_regno_nregs. (HARD_REGNO_NREGS): Delete. * config/cr16/cr16.c (TARGET_HARD_REGNO_NREGS): Redefine. (cr16_hard_regno_nregs): New function. (cr16_memory_move_cost): Use it instead of HARD_REGNO_NREGS. * config/cris/cris.h (HARD_REGNO_NREGS): Delete. * config/cris/cris.c (TARGET_HARD_REGNO_NREGS): Redefine. (cris_hard_regno_nregs): New function. * config/epiphany/epiphany.h (HARD_REGNO_NREGS): Delete. * config/fr30/fr30.h (HARD_REGNO_NREGS): Delete. (CLASS_MAX_NREGS): Use targetm.hard_regno_nregs. * config/frv/frv.h (HARD_REGNO_NREGS): Delete. (CLASS_MAX_NREGS): Remove outdated copy of documentation. * config/frv/frv-protos.h (frv_hard_regno_nregs): Delete. * config/frv/frv.c (TARGET_HARD_REGNO_NREGS): Redefine. (frv_hard_regno_nregs): Make static. Take and return an unsigned int. (frv_class_max_nregs): Remove outdated copy of documentation. * config/ft32/ft32.h (HARD_REGNO_NREGS): Delete. * config/h8300/h8300.h (HARD_REGNO_NREGS): Delete. * config/h8300/h8300-protos.h (h8300_hard_regno_nregs): Delete. * config/h8300/h8300.c (h8300_hard_regno_nregs): Delete. * config/i386/i386.h (HARD_REGNO_NREGS): Delete. * config/i386/i386.c (ix86_hard_regno_nregs): New function. (TARGET_HARD_REGNO_NREGS): Redefine. * config/ia64/ia64.h (HARD_REGNO_NREGS): Delete. (CLASS_MAX_NREGS): Update comment. * config/ia64/ia64.c (TARGET_HARD_REGNO_NREGS): Redefine. (ia64_hard_regno_nregs): New function. * config/iq2000/iq2000.h (HARD_REGNO_NREGS): Delete. * config/lm32/lm32.h (HARD_REGNO_NREGS): Delete. * config/m32c/m32c.h (HARD_REGNO_NREGS): Delete. * config/m32c/m32c-protos.h (m32c_hard_regno_nregs): Delete. * config/m32c/m32c.c (m32c_hard_regno_nregs_1): Take and return an unsigned int. (m32c_hard_regno_nregs): Likewise. Make static. (TARGET_HARD_REGNO_NREGS): Redefine. * config/m32r/m32r.h (HARD_REGNO_NREGS): Delete. * config/m68k/m68k.h (HARD_REGNO_NREGS): Delete. * config/m68k/m68k.c (TARGET_HARD_REGNO_NREGS): Redefine. (m68k_hard_regno_nregs): New function. * config/mcore/mcore.h (HARD_REGNO_NREGS): Delete. * config/microblaze/microblaze.h (HARD_REGNO_NREGS): Delete. * config/mips/mips.h (HARD_REGNO_NREGS): Delete. * config/mips/mips-protos.h (mips_hard_regno_nregs): Delete. * config/mips/mips.c (mips_hard_regno_nregs): Make static. Take and return an unsigned int. (TARGET_HARD_REGNO_NREGS): Redefine. * config/mmix/mmix.h (HARD_REGNO_NREGS): Delete. (CLASS_MAX_NREGS): Use targetm.hard_regno_nregs. * config/mn10300/mn10300.h (HARD_REGNO_NREGS): Delete. * config/moxie/moxie.h (HARD_REGNO_NREGS): Delete. * config/msp430/msp430.h (HARD_REGNO_NREGS): Delete. * config/msp430/msp430-protos.h (msp430_hard_regno_nregs): Delete. * config/msp430/msp430.c (TARGET_HARD_REGNO_NREGS): Redefine. (msp430_hard_regno_nregs): Make static. Take and return an unsigned int. * config/nds32/nds32.h (HARD_REGNO_NREGS): Delete. * config/nds32/nds32-protos.h (nds32_hard_regno_nregs): Delete. * config/nds32/nds32.c (nds32_hard_regno_nregs): Delete. (nds32_hard_regno_mode_ok): Use targetm.hard_regno_nregs. * config/nios2/nios2.h (HARD_REGNO_NREGS): Delete. * config/nvptx/nvptx.h (HARD_REGNO_NREGS): Delete. * config/nvptx/nvptx.c (nvptx_hard_regno_nregs): New function. (TARGET_HARD_REGNO_NREGS): Redefine. * config/pa/pa32-regs.h (HARD_REGNO_NREGS): Rename to... (PA_HARD_REGNO_NREGS): ...this. * config/pa/pa64-regs.h (HARD_REGNO_NREGS): Rename to... (PA_HARD_REGNO_NREGS): ...this. * config/pa/pa.c (TARGET_HARD_REGNO_NREGS): Redefine. (pa_hard_regno_nregs): New function. * config/pdp11/pdp11.h (HARD_REGNO_NREGS): Delete. * config/pdp11/pdp11.c (TARGET_HARD_REGNO_NREGS): Redefine. (pdp11_hard_regno_nregs): New function. * config/powerpcspe/powerpcspe.h (HARD_REGNO_NREGS): Delete. * config/powerpcspe/powerpcspe.c (TARGET_HARD_REGNO_NREGS): Redefine. (rs6000_hard_regno_nregs_hook): New function. * config/riscv/riscv.h (HARD_REGNO_NREGS): Delete. * config/riscv/riscv-protos.h (riscv_hard_regno_nregs): Delete. * config/riscv/riscv.c (riscv_hard_regno_nregs): Make static. Take and return an unsigned int. Move earlier in file. (TARGET_HARD_REGNO_NREGS): Redefine. * config/rl78/rl78.h (HARD_REGNO_NREGS): Delete. * config/rl78/rl78-protos.h (rl78_hard_regno_nregs): Delete. * config/rl78/rl78.c (TARGET_HARD_REGNO_NREGS): Reefine. (rl78_hard_regno_nregs): Make static. Take and return an unsigned int. * config/rs6000/rs6000.h (HARD_REGNO_NREGS): Delete. * config/rs6000/rs6000.c (TARGET_HARD_REGNO_NREGS): Redefine. (rs6000_hard_regno_nregs_hook): New function. * config/rx/rx.h (HARD_REGNO_NREGS): Delete. * config/rx/rx.c (rx_hard_regno_nregs): New function. (TARGET_HARD_REGNO_NREGS): Redefine. * config/s390/s390.h (HARD_REGNO_NREGS): Delete. * config/s390/s390.c (REGNO_PAIR_OK): Use s390_hard_regno_nregs instead of HARD_REGNO_NREGS. (s390_hard_regno_nregs): New function. (s390_hard_regno_mode_ok): Add comment from s390.h. (TARGET_HARD_REGNO_NREGS): Redefine. * config/sh/sh.h (HARD_REGNO_NREGS): Delete. * config/sh/sh.c (TARGET_HARD_REGNO_NREGS): Redefine. (sh_hard_regno_nregs): New function. (sh_pass_in_reg_p): Use it. * config/sparc/sparc.h (HARD_REGNO_NREGS): Delete. * config/sparc/sparc.c (TARGET_HARD_REGNO_NREGS): Redefine. (sparc_hard_regno_nregs): New function. * config/spu/spu.h (HARD_REGNO_NREGS): Delete. * config/spu/spu.c (spu_hard_regno_nregs): New function. (spu_function_arg_advance): Use it, supplying a valid register number. (TARGET_HARD_REGNO_NREGS): Redefine. * config/stormy16/stormy16.h (HARD_REGNO_NREGS): Delete. * config/tilegx/tilegx.h (HARD_REGNO_NREGS): Delete. * config/tilepro/tilepro.h (HARD_REGNO_NREGS): Delete. * config/v850/v850.h (HARD_REGNO_NREGS): Delete. * config/vax/vax.h (HARD_REGNO_NREGS): Delete. * config/visium/visium.h (HARD_REGNO_NREGS): Delete. (CLASS_MAX_NREGS): Remove copy of old documentation. * config/visium/visium.c (TARGET_HARD_REGNO_NREGS): Redefine. (visium_hard_regno_nregs): New function. (visium_hard_regno_mode_ok): Use it instead of HARD_REGNO_NREGS. * config/xtensa/xtensa.h (HARD_REGNO_NREGS): Delete. * config/xtensa/xtensa.c (TARGET_HARD_REGNO_NREGS): Redefine. xtensa_hard_regno_nregs): New function. * system.h (HARD_REGNO_NREGS): Poison. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r252016
Diffstat (limited to 'gcc/config/ia64')
-rw-r--r--gcc/config/ia64/ia64.c27
-rw-r--r--gcc/config/ia64/ia64.h18
2 files changed, 28 insertions, 17 deletions
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 4262870..d1f44d6 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -336,6 +336,7 @@ 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 unsigned int ia64_hard_regno_nregs (unsigned int, machine_mode);
static bool ia64_hard_regno_mode_ok (unsigned int, machine_mode);
static bool ia64_modes_tieable_p (machine_mode, machine_mode);
@@ -659,6 +660,8 @@ static const struct attribute_spec ia64_attribute_table[] =
#undef TARGET_CUSTOM_FUNCTION_DESCRIPTORS
#define TARGET_CUSTOM_FUNCTION_DESCRIPTORS 0
+#undef TARGET_HARD_REGNO_NREGS
+#define TARGET_HARD_REGNO_NREGS ia64_hard_regno_nregs
#undef TARGET_HARD_REGNO_MODE_OK
#define TARGET_HARD_REGNO_MODE_OK ia64_hard_regno_mode_ok
@@ -4263,6 +4266,30 @@ ia64_hard_regno_rename_ok (int from, int to)
return 1;
}
+/* Implement TARGET_HARD_REGNO_NREGS.
+
+ ??? We say that BImode PR values require two registers. This allows us to
+ easily store the normal and inverted values. We use CCImode to indicate
+ a single predicate register. */
+
+static unsigned int
+ia64_hard_regno_nregs (unsigned int regno, machine_mode mode)
+{
+ if (regno == PR_REG (0) && mode == DImode)
+ return 64;
+ if (PR_REGNO_P (regno) && (mode) == BImode)
+ return 2;
+ if ((PR_REGNO_P (regno) || GR_REGNO_P (regno)) && mode == CCImode)
+ return 1;
+ if (FR_REGNO_P (regno) && mode == XFmode)
+ return 1;
+ if (FR_REGNO_P (regno) && mode == RFmode)
+ return 1;
+ if (FR_REGNO_P (regno) && mode == XCmode)
+ return 2;
+ return CEIL (GET_MODE_SIZE (mode), UNITS_PER_WORD);
+}
+
/* Implement TARGET_HARD_REGNO_MODE_OK. */
static bool
diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h
index 6d76f5f..cdb91a3 100644
--- a/gcc/config/ia64/ia64.h
+++ b/gcc/config/ia64/ia64.h
@@ -598,22 +598,6 @@ while (0)
/* How Values Fit in Registers */
-/* A C expression for the number of consecutive hard registers, starting at
- register number REGNO, required to hold a value of mode MODE. */
-
-/* ??? We say that BImode PR values require two registers. This allows us to
- easily store the normal and inverted values. We use CCImode to indicate
- a single predicate register. */
-
-#define HARD_REGNO_NREGS(REGNO, MODE) \
- ((REGNO) == PR_REG (0) && (MODE) == DImode ? 64 \
- : PR_REGNO_P (REGNO) && (MODE) == BImode ? 2 \
- : (PR_REGNO_P (REGNO) || GR_REGNO_P (REGNO)) && (MODE) == CCImode ? 1\
- : FR_REGNO_P (REGNO) && (MODE) == XFmode ? 1 \
- : FR_REGNO_P (REGNO) && (MODE) == RFmode ? 1 \
- : FR_REGNO_P (REGNO) && (MODE) == XCmode ? 2 \
- : (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD)
-
/* Specify the modes required to caller save a given hard regno.
We need to ensure floating pt regs are not saved as DImode. */
@@ -803,7 +787,7 @@ enum reg_class
/* A C expression for the maximum number of consecutive registers of
class CLASS needed to hold a value of mode MODE.
- This is closely related to the macro `HARD_REGNO_NREGS'. */
+ This is closely related to TARGET_HARD_REGNO_NREGS. */
#define CLASS_MAX_NREGS(CLASS, MODE) \
((MODE) == BImode && (CLASS) == PR_REGS ? 2 \