diff options
author | aesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-11 17:41:24 +0000 |
---|---|---|
committer | aesok <aesok@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-11 17:41:24 +0000 |
commit | 09a175857d1d874775dcd00100214ece4945d9bb (patch) | |
tree | 4b63d698c47af01f476f8ddd1376746e9309a913 /gcc/doc/tm.texi.in | |
parent | 23423d0e7757b04c88648fa3fd964ce8f61477e1 (diff) | |
download | gcc-09a175857d1d874775dcd00100214ece4945d9bb.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165321 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc/tm.texi.in')
-rw-r--r-- | gcc/doc/tm.texi.in | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index c97b514ee46..84a071b6242 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 |