diff options
author | Anatoly Sokolov <aesok@post.ru> | 2010-10-11 21:41:24 +0400 |
---|---|---|
committer | Anatoly Sokolov <aesok@gcc.gnu.org> | 2010-10-11 21:41:24 +0400 |
commit | fba42e243e264f3b4d507d075b38c699821d5951 (patch) | |
tree | 4b63d698c47af01f476f8ddd1376746e9309a913 /gcc/doc | |
parent | 43c36287976d2cb4d134aff2952eca031c78eb59 (diff) | |
download | gcc-fba42e243e264f3b4d507d075b38c699821d5951.zip gcc-fba42e243e264f3b4d507d075b38c699821d5951.tar.gz gcc-fba42e243e264f3b4d507d075b38c699821d5951.tar.bz2 |
target.def (preferred_reload_class): New hook.
* target.def (preferred_reload_class): New hook.
* doc/tm.texi.in (TARGET_PREFERRED_RELOAD_CLASS): Document.
* doc/tm.texi: Regenerate.
* targhooks.c (default_preferred_reload_class): New function.
* targhooks.h (default_preferred_reload_class): Declare.
* reload.c (find_dummy_reload): Change preferred_class variable type
from enum reg_class to reg_class_t. Use TARGET_PREFERRED_RELOAD_CLASS
target hook.
(find_reloads): Change goal_alternative array type from int to
reg_class_t. Use TARGET_PREFERRED_RELOAD_CLASS target hook.
(push_reload, find_reloads_address_part): Use
TARGET_PREFERRED_RELOAD_CLASS target hook.
* reload1.c (emit_input_reload_insns): Ditto.
* ira-costs.c (copy_cost): Use TARGET_PREFERRED_RELOAD_CLASS target
hook. Change rclass argument and secondary_class variable types from
'enum reg_class' to reg_class_t.
* config/i386/i386.h (PREFERRED_RELOAD_CLASS): Remove.
* config/i386/i386-protos (ix86_preferred_reload_class): Remove.
* config/i386/i386.c (ix86_preferred_reload_class): Make static.
Change regclass argument and result types from enum reg_class to
reg_class_t.
(TARGET_PREFERRED_RELOAD_CLASS): Define.
From-SVN: r165321
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/tm.texi | 34 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 34 |
2 files changed, 68 insertions, 0 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 298b3b9..55a9897 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -2585,6 +2585,40 @@ only if neither labeling works. This macro also has strict and non-strict variants. @end defmac +@deftypefn {Target Hook} reg_class_t TARGET_PREFERRED_RELOAD_CLASS (rtx @var{x}, reg_class_t @var{rclass}) +A target hook that places additional restrictions on the register class +to use when it is necessary to copy value @var{x} into a register in class +@var{rclass}. The value is a register class; perhaps @var{rclass}, or perhaps +another, smaller class. + +The default version of this hook always returns value of @code{rclass} argument. + +Sometimes returning a more restrictive class makes better code. For +example, on the 68000, when @var{x} is an integer constant that is in range +for a @samp{moveq} instruction, the value of this macro is always +@code{DATA_REGS} as long as @var{rclass} includes the data registers. +Requiring a data register guarantees that a @samp{moveq} will be used. + +One case where @code{TARGET_PREFERRED_RELOAD_CLASS} must not return +@var{rclass} is if @var{x} is a legitimate constant which cannot be +loaded into some register class. By returning @code{NO_REGS} you can +force @var{x} into a memory location. For example, rs6000 can load +immediate values into general-purpose registers, but does not have an +instruction for loading an immediate value into a floating-point +register, so @code{TARGET_PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when +@var{x} is a floating-point constant. If the constant can't be loaded +into any kind of register, code generation will be better if +@code{LEGITIMATE_CONSTANT_P} makes the constant illegitimate instead +of using @code{TARGET_PREFERRED_RELOAD_CLASS}. + +If an insn has pseudos in it after register allocation, reload will go +through the alternatives and call repeatedly @code{TARGET_PREFERRED_RELOAD_CLASS} +to find the best one. Returning @code{NO_REGS}, in this case, makes +reload add a @code{!} in front of the constraint: the x86 back-end uses +this feature to discourage usage of 387 registers when math is done in +the SSE registers (and vice versa). +@end deftypefn + @defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class}) A C expression that places additional restrictions on the register class to use when it is necessary to copy value @var{x} into a register in class diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index c97b514..84a071b 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -2583,6 +2583,40 @@ only if neither labeling works. This macro also has strict and non-strict variants. @end defmac +@hook TARGET_PREFERRED_RELOAD_CLASS +A target hook that places additional restrictions on the register class +to use when it is necessary to copy value @var{x} into a register in class +@var{rclass}. The value is a register class; perhaps @var{rclass}, or perhaps +another, smaller class. + +The default version of this hook always returns value of @code{rclass} argument. + +Sometimes returning a more restrictive class makes better code. For +example, on the 68000, when @var{x} is an integer constant that is in range +for a @samp{moveq} instruction, the value of this macro is always +@code{DATA_REGS} as long as @var{rclass} includes the data registers. +Requiring a data register guarantees that a @samp{moveq} will be used. + +One case where @code{TARGET_PREFERRED_RELOAD_CLASS} must not return +@var{rclass} is if @var{x} is a legitimate constant which cannot be +loaded into some register class. By returning @code{NO_REGS} you can +force @var{x} into a memory location. For example, rs6000 can load +immediate values into general-purpose registers, but does not have an +instruction for loading an immediate value into a floating-point +register, so @code{TARGET_PREFERRED_RELOAD_CLASS} returns @code{NO_REGS} when +@var{x} is a floating-point constant. If the constant can't be loaded +into any kind of register, code generation will be better if +@code{LEGITIMATE_CONSTANT_P} makes the constant illegitimate instead +of using @code{TARGET_PREFERRED_RELOAD_CLASS}. + +If an insn has pseudos in it after register allocation, reload will go +through the alternatives and call repeatedly @code{TARGET_PREFERRED_RELOAD_CLASS} +to find the best one. Returning @code{NO_REGS}, in this case, makes +reload add a @code{!} in front of the constraint: the x86 back-end uses +this feature to discourage usage of 387 registers when math is done in +the SSE registers (and vice versa). +@end deftypefn + @defmac PREFERRED_RELOAD_CLASS (@var{x}, @var{class}) A C expression that places additional restrictions on the register class to use when it is necessary to copy value @var{x} into a register in class |