diff options
author | Jan Hubicka <jh@suse.cz> | 2007-01-28 20:38:39 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2007-01-28 19:38:39 +0000 |
commit | 079a182e02a0720f9ac230c212fd202df3e6bd9e (patch) | |
tree | f0b99d930c723a2db6886a47a653581d98be0f1a /gcc/builtins.c | |
parent | 2472200d9c53250482c75443611251490b23e5f2 (diff) | |
download | gcc-079a182e02a0720f9ac230c212fd202df3e6bd9e.zip gcc-079a182e02a0720f9ac230c212fd202df3e6bd9e.tar.gz gcc-079a182e02a0720f9ac230c212fd202df3e6bd9e.tar.bz2 |
expr.c (emit_block_move_via_movmem, [...]): Add variant handling histograms; add wrapper.
* expr.c (emit_block_move_via_movmem, emit_block_move_via_libcall): Add
variant handling histograms; add wrapper.
(clear_storage_via_libcall): Export.
(emit_block_move_hints): Break out from ...; add histograms.
(emit_block_move): ... this one.
(clear_storage_hints): Break out from ...; add histograms.
(clear_storage): ... this one.
(set_storage_via_memset): Handle histogram.
* expr.h (emit_block_move_via_libcall, emit_block_move_hints): Declare.
(clear_storage_hints, clear_storage_via_libcall): Declare.
(set_storage_via_setmem): Update prototype.
* doc/md.texi (movmem, setmem): Document new arguments.
* value-prof.c (dump_histogram_value, tree_find_values_to_profile): Add
new histograms.
(stringop_block_profile): New global function.
(tree_stringops_values_to_profile): Profile block size and alignment.
* value-prof.h (enum hist_type): add HIST_TYPE_AVERAGE and
HIST_TYPE_IOR.
(struct profile_hooks): Add gen_average_profiler and gen_ior_profiler.
(stringop_block_profile): Declare.
* builtins.c: Include value-prof.h.
(expand_builtin_memcpy, expand_builtin_memset): Pass block profile.
* gcov-ui.h (GCOV_COUNTER_NAMES): Add new counter.
(GCOV_COUNTER_AVERAGE, GCOV_COUNTER_IOR): New constants.
(GCOV_COUNTERS, GCOV_LAST_VALUE_COUNTER): Update.
* profile.c (instrument_values): Add new counters.
* cfgexpand.c (expand_gimple_basic_block): Propagate histograms to
calls.
* tree-profile.c (tree_average_profiler_fn, tree_ior_profiler_fn): New.
(tree_init_edge_profiler): Build new profilers.
(tree_gen_average_profiler, tree_gen_ior_profiler): New.
(pass_tree_profile): Add dump.
(tree_profile_hooks): Update.
* Makefile.in (LIBGCOV): Add new constants.
* libgcov.c (__gcov_merge_ior, __gcov_average_profiler,
__gcov_ior_profiler): New.
* i386.md (movmem/setmem expanders): Add new optional arguments.
From-SVN: r121270
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index d122379..7947907 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -49,6 +49,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA #include "basic-block.h" #include "tree-mudflap.h" #include "tree-flow.h" +#include "value-prof.h" #ifndef PAD_VARARGS_DOWN #define PAD_VARARGS_DOWN BYTES_BIG_ENDIAN @@ -3099,6 +3100,8 @@ expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode) rtx dest_mem, src_mem, dest_addr, len_rtx; tree result = fold_builtin_memory_op (arglist, TREE_TYPE (TREE_TYPE (fndecl)), false, /*endp=*/0); + HOST_WIDE_INT expected_size = -1; + unsigned int expected_align = 0; if (result) { @@ -3119,7 +3122,10 @@ expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode) operation in-line. */ if (src_align == 0) return 0; - + + stringop_block_profile (exp, &expected_align, &expected_size); + if (expected_align < dest_align) + expected_align = dest_align; dest_mem = get_memory_rtx (dest, len); set_mem_align (dest_mem, dest_align); len_rtx = expand_normal (len); @@ -3146,9 +3152,10 @@ expand_builtin_memcpy (tree exp, rtx target, enum machine_mode mode) set_mem_align (src_mem, src_align); /* Copy word part most expediently. */ - dest_addr = emit_block_move (dest_mem, src_mem, len_rtx, - CALL_EXPR_TAILCALL (exp) - ? BLOCK_OP_TAILCALL : BLOCK_OP_NORMAL); + dest_addr = emit_block_move_hints (dest_mem, src_mem, len_rtx, + CALL_EXPR_TAILCALL (exp) + ? BLOCK_OP_TAILCALL : BLOCK_OP_NORMAL, + expected_align, expected_size); if (dest_addr == 0) { @@ -3640,6 +3647,8 @@ expand_builtin_memset (tree arglist, rtx target, enum machine_mode mode, char c; unsigned int dest_align; rtx dest_mem, dest_addr, len_rtx; + HOST_WIDE_INT expected_size = -1; + unsigned int expected_align = 0; dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT); @@ -3648,6 +3657,10 @@ expand_builtin_memset (tree arglist, rtx target, enum machine_mode mode, if (dest_align == 0) return 0; + stringop_block_profile (orig_exp, &expected_align, &expected_size); + if (expected_align < dest_align) + expected_align = dest_align; + /* If the LEN parameter is zero, return DEST. */ if (integer_zerop (len)) { @@ -3687,7 +3700,7 @@ expand_builtin_memset (tree arglist, rtx target, enum machine_mode mode, builtin_memset_gen_str, val_rtx, dest_align, 0); } else if (!set_storage_via_setmem (dest_mem, len_rtx, val_rtx, - dest_align)) + dest_align, -1, 0)) goto do_libcall; dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); @@ -3707,7 +3720,8 @@ expand_builtin_memset (tree arglist, rtx target, enum machine_mode mode, store_by_pieces (dest_mem, tree_low_cst (len, 1), builtin_memset_read_str, &c, dest_align, 0); else if (!set_storage_via_setmem (dest_mem, len_rtx, GEN_INT (c), - dest_align)) + dest_align, expected_align, + expected_size)) goto do_libcall; dest_mem = force_operand (XEXP (dest_mem, 0), NULL_RTX); @@ -3716,9 +3730,10 @@ expand_builtin_memset (tree arglist, rtx target, enum machine_mode mode, } set_mem_align (dest_mem, dest_align); - dest_addr = clear_storage (dest_mem, len_rtx, - CALL_EXPR_TAILCALL (orig_exp) - ? BLOCK_OP_TAILCALL : BLOCK_OP_NORMAL); + dest_addr = clear_storage_hints (dest_mem, len_rtx, + CALL_EXPR_TAILCALL (orig_exp) + ? BLOCK_OP_TAILCALL : BLOCK_OP_NORMAL, + expected_align, expected_size); if (dest_addr == 0) { |