diff options
author | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-09-12 13:27:55 +0000 |
---|---|---|
committer | rsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-09-12 13:27:55 +0000 |
commit | dfdced85e532272576bec46545de1ff3aaa3055a (patch) | |
tree | 3ca0e90f453bcc3361eb758707d8da86a656477f /gcc/doc | |
parent | bad1c260cc73d1c2801323156a8c9db0b5e3cdac (diff) | |
download | gcc-dfdced85e532272576bec46545de1ff3aaa3055a.tar.gz |
Turn SLOW_UNALIGNED_ACCESS 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/
* defaults.h (SLOW_UNALIGNED_ACCESS): Delete.
* target.def (slow_unaligned_access): New hook.
* targhooks.h (default_slow_unaligned_access): Declare.
* targhooks.c (default_slow_unaligned_access): New function.
* doc/tm.texi.in (SLOW_UNALIGNED_ACCESS): Replace with...
(TARGET_SLOW_UNALIGNED_ACCESS): ...this.
* doc/tm.texi: Regenerate.
* config/alpha/alpha.h (SLOW_UNALIGNED_ACCESS): Delete.
* config/arm/arm.h (SLOW_UNALIGNED_ACCESS): Delete.
* config/i386/i386.h (SLOW_UNALIGNED_ACCESS): Delete commented-out
definition.
* config/powerpcspe/powerpcspe.h (SLOW_UNALIGNED_ACCESS): Delete.
* config/powerpcspe/powerpcspe.c (TARGET_SLOW_UNALIGNED_ACCESS):
Redefine.
(rs6000_slow_unaligned_access): New function.
(rs6000_emit_move): Use it instead of SLOW_UNALIGNED_ACCESS.
(expand_block_compare): Likewise.
(expand_strn_compare): Likewise.
(rs6000_rtx_costs): Likewise.
* config/riscv/riscv.h (SLOW_UNALIGNED_ACCESS): Delete.
(riscv_slow_unaligned_access): Likewise.
* config/riscv/riscv.c (riscv_slow_unaligned_access): Rename to...
(riscv_slow_unaligned_access_p): ...this and make static.
(riscv_option_override): Update accordingly.
(riscv_slow_unaligned_access): New function.
(TARGET_SLOW_UNALIGNED_ACCESS): Redefine.
* config/rs6000/rs6000.h (SLOW_UNALIGNED_ACCESS): Delete.
* config/rs6000/rs6000.c (TARGET_SLOW_UNALIGNED_ACCESS): Redefine.
(rs6000_slow_unaligned_access): New function.
(rs6000_emit_move): Use it instead of SLOW_UNALIGNED_ACCESS.
(rs6000_rtx_costs): Likewise.
* config/rs6000/rs6000-string.c (expand_block_compare)
(expand_strn_compare): Use targetm.slow_unaligned_access instead
of SLOW_UNALIGNED_ACCESS.
* config/tilegx/tilegx.h (SLOW_UNALIGNED_ACCESS): Delete.
* config/tilepro/tilepro.h (SLOW_UNALIGNED_ACCESS): Delete.
* calls.c (expand_call): Use targetm.slow_unaligned_access instead
of SLOW_UNALIGNED_ACCESS.
* expmed.c (simple_mem_bitfield_p): Likewise.
* expr.c (alignment_for_piecewise_move): Likewise.
(emit_group_load_1): Likewise.
(emit_group_store): Likewise.
(copy_blkmode_from_reg): Likewise.
(emit_push_insn): Likewise.
(expand_assignment): Likewise.
(store_field): Likewise.
(expand_expr_real_1): Likewise.
* gimple-fold.c (gimple_fold_builtin_memory_op): Likewise.
* lra-constraints.c (simplify_operand_subreg): Likewise.
* stor-layout.c (bit_field_mode_iterator::next_mode): Likewise.
* gimple-ssa-store-merging.c: Likewise in block comment at start
of file.
* tree-ssa-strlen.c: Include target.h.
(handle_builtin_memcmp): Use targetm.slow_unaligned_access instead
of SLOW_UNALIGNED_ACCESS.
* system.h (SLOW_UNALIGNED_ACCESS): Poison.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252009 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/tm.texi | 23 | ||||
-rw-r--r-- | gcc/doc/tm.texi.in | 18 |
2 files changed, 12 insertions, 29 deletions
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index c29d249d0d5..eb8a6189b95 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6386,23 +6386,22 @@ may eliminate subsequent memory access if subsequent accesses occur to other fields in the same word of the structure, but to different bytes. @end defmac -@defmac SLOW_UNALIGNED_ACCESS (@var{mode}, @var{alignment}) -Define this macro to be the value 1 if memory accesses described by the +@deftypefn {Target Hook} bool TARGET_SLOW_UNALIGNED_ACCESS (machine_mode @var{mode}, unsigned int @var{align}) +This hook returns true if memory accesses described by the @var{mode} and @var{alignment} parameters have a cost many times greater -than aligned accesses, for example if they are emulated in a trap -handler. This macro is invoked only for unaligned accesses, i.e. when +than aligned accesses, for example if they are emulated in a trap handler. +This hook is invoked only for unaligned accesses, i.e. when @code{@var{alignment} < GET_MODE_ALIGNMENT (@var{mode})}. -When this macro is nonzero, the compiler will act as if -@code{STRICT_ALIGNMENT} were nonzero when generating code for block +When this hook returns true, the compiler will act as if +@code{STRICT_ALIGNMENT} were true when generating code for block moves. This can cause significantly more instructions to be produced. -Therefore, do not set this macro nonzero if unaligned accesses only add a -cycle or two to the time for a memory access. +Therefore, do not make this hook return true if unaligned accesses only +add a cycle or two to the time for a memory access. -If the value of this macro is always zero, it need not be defined. If -this macro is defined, it should produce a nonzero value when -@code{STRICT_ALIGNMENT} is nonzero. -@end defmac +The hook must return true whenever @code{STRICT_ALIGNMENT} is true. +The default implementation returns @code{STRICT_ALIGNMENT}. +@end deftypefn @defmac MOVE_RATIO (@var{speed}) The threshold of number of scalar memory-to-memory move insns, @emph{below} diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 8c35a0a0261..ce51bbad22c 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -4559,23 +4559,7 @@ may eliminate subsequent memory access if subsequent accesses occur to other fields in the same word of the structure, but to different bytes. @end defmac -@defmac SLOW_UNALIGNED_ACCESS (@var{mode}, @var{alignment}) -Define this macro to be the value 1 if memory accesses described by the -@var{mode} and @var{alignment} parameters have a cost many times greater -than aligned accesses, for example if they are emulated in a trap -handler. This macro is invoked only for unaligned accesses, i.e. when -@code{@var{alignment} < GET_MODE_ALIGNMENT (@var{mode})}. - -When this macro is nonzero, the compiler will act as if -@code{STRICT_ALIGNMENT} were nonzero when generating code for block -moves. This can cause significantly more instructions to be produced. -Therefore, do not set this macro nonzero if unaligned accesses only add a -cycle or two to the time for a memory access. - -If the value of this macro is always zero, it need not be defined. If -this macro is defined, it should produce a nonzero value when -@code{STRICT_ALIGNMENT} is nonzero. -@end defmac +@hook TARGET_SLOW_UNALIGNED_ACCESS @defmac MOVE_RATIO (@var{speed}) The threshold of number of scalar memory-to-memory move insns, @emph{below} |