diff options
Diffstat (limited to 'gcc/target.def')
-rw-r--r-- | gcc/target.def | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/target.def b/gcc/target.def index 689c0a0..ca9dc87 100644 --- a/gcc/target.def +++ b/gcc/target.def @@ -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 |