From a5474c4cb0cd4499437eeffd7223bb7533100d48 Mon Sep 17 00:00:00 2001 From: James Greenhalgh Date: Sat, 1 Nov 2014 10:38:42 +0000 Subject: [PATCH] [Patch 7/7] Remove *_BY_PIECES_P gcc/ * doc/tm.texi.in (MOVE_BY_PIECES_P): Remove. (CLEAR_BY_PIECES_P): Likewise. (SET_BY_PIECES_P): Likewise. (STORE_BY_PIECES_P): Likewise. * doc/tm.texi: Regenerate. * system.h: Poison MOVE_BY_PIECES_P, CLEAR_BY_PIECES_P, SET_BY_PIECES_P, STORE_BY_PIECES_P. * expr.c (MOVE_BY_PIECES_P): Remove. (CLEAR_BY_PIECES_P): Likewise. (SET_BY_PIECES_P): Likewise. (STORE_BY_PIECES_P): Likewise. (can_move_by_pieces): Rewrite in terms of targetm.use_by_pieces_infrastructure_p. (emit_block_move_hints): Likewise. (can_store_by_pieces): Likewise. (store_by_pieces): Likewise. (clear_storage_hints): Likewise. (emit_push_insn): Likewise. (expand_constructor): Likewise. From-SVN: r217004 --- gcc/ChangeLog | 22 ++++++++++++++++ gcc/doc/tm.texi | 44 ------------------------------- gcc/doc/tm.texi.in | 44 ------------------------------- gcc/expr.c | 66 ++++++++++++++++------------------------------ gcc/system.h | 4 ++- 5 files changed, 47 insertions(+), 133 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 99150b4f934..f1641af3ff8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2014-11-01 James Greenhalgh + + * doc/tm.texi.in (MOVE_BY_PIECES_P): Remove. + (CLEAR_BY_PIECES_P): Likewise. + (SET_BY_PIECES_P): Likewise. + (STORE_BY_PIECES_P): Likewise. + * doc/tm.texi: Regenerate. + * system.h: Poison MOVE_BY_PIECES_P, CLEAR_BY_PIECES_P, + SET_BY_PIECES_P, STORE_BY_PIECES_P. + * expr.c (MOVE_BY_PIECES_P): Remove. + (CLEAR_BY_PIECES_P): Likewise. + (SET_BY_PIECES_P): Likewise. + (STORE_BY_PIECES_P): Likewise. + (can_move_by_pieces): Rewrite in terms of + targetm.use_by_pieces_infrastructure_p. + (emit_block_move_hints): Likewise. + (can_store_by_pieces): Likewise. + (store_by_pieces): Likewise. + (clear_storage_hints): Likewise. + (emit_push_insn): Likewise. + (expand_constructor): Likewise. + 2014-11-01 James Greenhalgh * config/aarch64/aarch64.c diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index cfb838897aa..0d1f1499968 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -6123,16 +6123,6 @@ optimized for speed rather than size. If you don't define this, a reasonable default is used. @end defmac -@defmac MOVE_BY_PIECES_P (@var{size}, @var{alignment}) -A C expression used to determine whether @code{move_by_pieces} will be used to -copy a chunk of memory, or whether some other block move mechanism -will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less -than @code{MOVE_RATIO}. - -This macro is deprecated. New ports should implement -@code{TARGET_USE_BY_PIECES_INFRASTRUCTURE_P} instead. -@end defmac - @deftypefn {Target Hook} bool TARGET_USE_BY_PIECES_INFRASTRUCTURE_P (unsigned int @var{size}, unsigned int @var{alignment}, enum by_pieces_operation @var{op}, bool @var{speed_p}) GCC will attempt several strategies when asked to copy between two areas of memory, or to set, clear or store to memory, for example @@ -6184,16 +6174,6 @@ optimized for speed rather than size. If you don't define this, a reasonable default is used. @end defmac -@defmac CLEAR_BY_PIECES_P (@var{size}, @var{alignment}) -A C expression used to determine whether @code{clear_by_pieces} will be used -to clear a chunk of memory, or whether some other block clear mechanism -will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less -than @code{CLEAR_RATIO}. - -This macro is deprecated. New ports should implement -@code{TARGET_USE_BY_PIECES_INFRASTRUCTURE_P} instead. -@end defmac - @defmac SET_RATIO (@var{speed}) The threshold of number of scalar move insns, @emph{below} which a sequence of insns should be generated to set memory to a constant value, instead of @@ -6207,30 +6187,6 @@ optimized for speed rather than size. If you don't define this, it defaults to the value of @code{MOVE_RATIO}. @end defmac -@defmac SET_BY_PIECES_P (@var{size}, @var{alignment}) -A C expression used to determine whether @code{store_by_pieces} will be -used to set a chunk of memory to a constant value, or whether some -other mechanism will be used. Used by @code{__builtin_memset} when -storing values other than constant zero. -Defaults to 1 if @code{move_by_pieces_ninsns} returns less -than @code{SET_RATIO}. - -This macro is deprecated. New ports should implement -@code{TARGET_USE_BY_PIECES_INFRASTRUCTURE_P} instead. -@end defmac - -@defmac STORE_BY_PIECES_P (@var{size}, @var{alignment}) -A C expression used to determine whether @code{store_by_pieces} will be -used to set a chunk of memory to a constant string value, or whether some -other mechanism will be used. Used by @code{__builtin_strcpy} when -called with a constant source string. -Defaults to 1 if @code{move_by_pieces_ninsns} returns less -than @code{MOVE_RATIO}. - -This macro is deprecated. New ports should implement -@code{TARGET_USE_BY_PIECES_INFRASTRUCTURE_P} instead. -@end defmac - @defmac USE_LOAD_POST_INCREMENT (@var{mode}) A C expression used to determine whether a load postincrement is a good thing to use for a given mode. Defaults to the value of diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index 3f66543753f..679b3d113b0 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -4600,16 +4600,6 @@ optimized for speed rather than size. If you don't define this, a reasonable default is used. @end defmac -@defmac MOVE_BY_PIECES_P (@var{size}, @var{alignment}) -A C expression used to determine whether @code{move_by_pieces} will be used to -copy a chunk of memory, or whether some other block move mechanism -will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less -than @code{MOVE_RATIO}. - -This macro is deprecated. New ports should implement -@code{TARGET_USE_BY_PIECES_INFRASTRUCTURE_P} instead. -@end defmac - @hook TARGET_USE_BY_PIECES_INFRASTRUCTURE_P @defmac MOVE_MAX_PIECES @@ -4629,16 +4619,6 @@ optimized for speed rather than size. If you don't define this, a reasonable default is used. @end defmac -@defmac CLEAR_BY_PIECES_P (@var{size}, @var{alignment}) -A C expression used to determine whether @code{clear_by_pieces} will be used -to clear a chunk of memory, or whether some other block clear mechanism -will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less -than @code{CLEAR_RATIO}. - -This macro is deprecated. New ports should implement -@code{TARGET_USE_BY_PIECES_INFRASTRUCTURE_P} instead. -@end defmac - @defmac SET_RATIO (@var{speed}) The threshold of number of scalar move insns, @emph{below} which a sequence of insns should be generated to set memory to a constant value, instead of @@ -4652,30 +4632,6 @@ optimized for speed rather than size. If you don't define this, it defaults to the value of @code{MOVE_RATIO}. @end defmac -@defmac SET_BY_PIECES_P (@var{size}, @var{alignment}) -A C expression used to determine whether @code{store_by_pieces} will be -used to set a chunk of memory to a constant value, or whether some -other mechanism will be used. Used by @code{__builtin_memset} when -storing values other than constant zero. -Defaults to 1 if @code{move_by_pieces_ninsns} returns less -than @code{SET_RATIO}. - -This macro is deprecated. New ports should implement -@code{TARGET_USE_BY_PIECES_INFRASTRUCTURE_P} instead. -@end defmac - -@defmac STORE_BY_PIECES_P (@var{size}, @var{alignment}) -A C expression used to determine whether @code{store_by_pieces} will be -used to set a chunk of memory to a constant string value, or whether some -other mechanism will be used. Used by @code{__builtin_strcpy} when -called with a constant source string. -Defaults to 1 if @code{move_by_pieces_ninsns} returns less -than @code{MOVE_RATIO}. - -This macro is deprecated. New ports should implement -@code{TARGET_USE_BY_PIECES_INFRASTRUCTURE_P} instead. -@end defmac - @defmac USE_LOAD_POST_INCREMENT (@var{mode}) A C expression used to determine whether a load postincrement is a good thing to use for a given mode. Defaults to the value of diff --git a/gcc/expr.c b/gcc/expr.c index ef851777c47..af42b616881 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -167,37 +167,6 @@ static void do_tablejump (rtx, machine_mode, rtx, rtx, rtx, int); static rtx const_vector_from_tree (tree); static void write_complex_part (rtx, rtx, bool); -/* This macro is used to determine whether move_by_pieces should be called - to perform a structure copy. */ -#ifndef MOVE_BY_PIECES_P -#define MOVE_BY_PIECES_P(SIZE, ALIGN) \ - (targetm.use_by_pieces_infrastructure_p (SIZE, ALIGN, MOVE_BY_PIECES, \ - optimize_insn_for_speed_p ())) -#endif - -/* This macro is used to determine whether clear_by_pieces should be - called to clear storage. */ -#ifndef CLEAR_BY_PIECES_P -#define CLEAR_BY_PIECES_P(SIZE, ALIGN) \ - (targetm.use_by_pieces_infrastructure_p (SIZE, ALIGN, CLEAR_BY_PIECES, \ - optimize_insn_for_speed_p ())) -#endif - -/* This macro is used to determine whether store_by_pieces should be - called to "memset" storage with byte values other than zero. */ -#ifndef SET_BY_PIECES_P -#define SET_BY_PIECES_P(SIZE, ALIGN) \ - (targetm.use_by_pieces_infrastructure_p (SIZE, ALIGN, SET_BY_PIECES, \ - optimize_insn_for_speed_p ())) -#endif - -/* This macro is used to determine whether store_by_pieces should be - called to "memcpy" storage when the source is a constant string. */ -#ifndef STORE_BY_PIECES_P -#define STORE_BY_PIECES_P(SIZE, ALIGN) \ - (targetm.use_by_pieces_infrastructure_p (SIZE, ALIGN, STORE_BY_PIECES, \ - optimize_insn_for_speed_p ())) -#endif /* This is run to set up which modes can be used directly in memory and to initialize the block move optab. It is run @@ -832,10 +801,11 @@ widest_int_mode_for_size (unsigned int size) succeed. */ int -can_move_by_pieces (unsigned HOST_WIDE_INT len ATTRIBUTE_UNUSED, - unsigned int align ATTRIBUTE_UNUSED) +can_move_by_pieces (unsigned HOST_WIDE_INT len, + unsigned int align) { - return MOVE_BY_PIECES_P (len, align); + return targetm.use_by_pieces_infrastructure_p (len, align, MOVE_BY_PIECES, + optimize_insn_for_speed_p ()); } /* Generate several move instructions to copy LEN bytes from block FROM to @@ -1172,7 +1142,7 @@ emit_block_move_hints (rtx x, rtx y, rtx size, enum block_op_methods method, set_mem_size (y, INTVAL (size)); } - if (CONST_INT_P (size) && MOVE_BY_PIECES_P (INTVAL (size), align)) + if (CONST_INT_P (size) && can_move_by_pieces (INTVAL (size), align)) move_by_pieces (x, y, INTVAL (size), align, 0); else if (emit_block_move_via_movmem (x, y, size, align, expected_align, expected_size, @@ -2489,9 +2459,11 @@ can_store_by_pieces (unsigned HOST_WIDE_INT len, if (len == 0) return 1; - if (! (memsetp - ? SET_BY_PIECES_P (len, align) - : STORE_BY_PIECES_P (len, align))) + if (!targetm.use_by_pieces_infrastructure_p (len, align, + memsetp + ? SET_BY_PIECES + : STORE_BY_PIECES, + optimize_insn_for_speed_p ())) return 0; align = alignment_for_piecewise_move (STORE_MAX_PIECES, align); @@ -2567,9 +2539,13 @@ store_by_pieces (rtx to, unsigned HOST_WIDE_INT len, return to; } - gcc_assert (memsetp - ? SET_BY_PIECES_P (len, align) - : STORE_BY_PIECES_P (len, align)); + gcc_assert (targetm.use_by_pieces_infrastructure_p + (len, align, + memsetp + ? SET_BY_PIECES + : STORE_BY_PIECES, + optimize_insn_for_speed_p ())); + data.constfun = constfun; data.constfundata = constfundata; data.len = len; @@ -2806,7 +2782,9 @@ clear_storage_hints (rtx object, rtx size, enum block_op_methods method, align = MEM_ALIGN (object); if (CONST_INT_P (size) - && CLEAR_BY_PIECES_P (INTVAL (size), align)) + && targetm.use_by_pieces_infrastructure_p (INTVAL (size), align, + CLEAR_BY_PIECES, + optimize_insn_for_speed_p ())) clear_by_pieces (object, INTVAL (size), align); else if (set_storage_via_setmem (object, size, const0_rtx, align, expected_align, expected_size, @@ -4215,7 +4193,7 @@ emit_push_insn (rtx x, machine_mode mode, tree type, rtx size, && CONST_INT_P (size) && skip == 0 && MEM_ALIGN (xinner) >= align - && (MOVE_BY_PIECES_P ((unsigned) INTVAL (size) - used, align)) + && can_move_by_pieces ((unsigned) INTVAL (size) - used, align) /* Here we avoid the case of a structure whose weak alignment forces many pushes of a small amount of data, and such small pushes do rounding that causes trouble. */ @@ -7836,7 +7814,7 @@ expand_constructor (tree exp, rtx target, enum expand_modifier modifier, && ! (target != 0 && safe_from_p (target, exp, 1))) || TREE_ADDRESSABLE (exp) || (tree_fits_uhwi_p (TYPE_SIZE_UNIT (type)) - && (! MOVE_BY_PIECES_P + && (! can_move_by_pieces (tree_to_uhwi (TYPE_SIZE_UNIT (type)), TYPE_ALIGN (type))) && ! mostly_zeros_p (exp)))) diff --git a/gcc/system.h b/gcc/system.h index dbe1ceb3d8a..74ddfe94a59 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -847,7 +847,9 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; HOT_TEXT_SECTION_NAME LEGITIMATE_CONSTANT_P ALWAYS_STRIP_DOTDOT \ OUTPUT_ADDR_CONST_EXTRA SMALL_REGISTER_CLASSES ASM_OUTPUT_IDENT \ ASM_BYTE_OP MEMBER_TYPE_FORCES_BLK LIBGCC2_HAS_SF_MODE \ - LIBGCC2_HAS_DF_MODE LIBGCC2_HAS_XF_MODE LIBGCC2_HAS_TF_MODE + LIBGCC2_HAS_DF_MODE LIBGCC2_HAS_XF_MODE LIBGCC2_HAS_TF_MODE \ + CLEAR_BY_PIECES_P MOVE_BY_PIECES_P SET_BY_PIECES_P \ + STORE_BY_PIECES_P /* Target macros only used for code built for the target, that have moved to libgcc-tm.h or have never been present elsewhere. */ -- 2.30.2