gcc/gcc/value-prof.c

1143 lines
34 KiB
C
Raw Normal View History

/* Transformations based on profile information for values.
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any later
version.
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
2005-06-25 04:02:01 +02:00
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "rtl.h"
#include "expr.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "value-prof.h"
#include "output.h"
#include "flags.h"
#include "insn-config.h"
#include "recog.h"
#include "optabs.h"
#include "regs.h"
Makefile.in (rtl-profile.o, [...]): Add GCC_H dependency. * Makefile.in (rtl-profile.o, value-prof.o): Add GCC_H dependency. * common.opt (fspeculative-prefetching): New. * flags.h (flag_speculative_prefetching_set): Declare. * gcov-io.c (gcov_write_counter, gcov_read_counter): Allow negative values. * opts.c (flag_sepculative_prefetching_set): New variable. (common_handle_option): Handle -fspeculative-prefetching. * passes.c (rest_of_compilation): Ditto. * profile.c (instrument_values, compute_value_histograms, branch_prob): Use vectors instead of arrays. * toplev.c (process_options): Handle -fspeculative-prefetching. * rtl-profile.c: Include ggc.h. (rtl_gen_interval_profiler, rtl_gen_pow2_profiler, rtl_gen_one_value_profiler_no_edge_manipulation, rtl_gen_one_value_profiler, rtl_gen_const_delta_profiler): Type of argument changed. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Type of argument changed. * value-prof.c: Include ggc.h. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX): New macros. (insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, gen_speculative_prefetch, speculative_prefetching_transform): New. (value_profile_transformations): Call speculative_prefetching_transform. (insn_values_to_profile): Call insn_prefetch_values_to_profile. (insn_divmod_values_to_profile, rtl_find_values_to_profile, tree_find_values_to_profile, find_values to profile): Use vectors instead of arrays. (free_profiled_values): Removed. * value-prof.h (struct histogram_value): Renamed to struct histogram_value_t. (histogram_value, histogram_values): New types. (find_values_to_profile): Declaration changed. (free_profiled_values): Removed. (struct profile_hooks): Type of argument of the hooks changed to histogram_value. * doc/invoke.texi (-fspeculative-prefetching): Document. From-SVN: r86930
2004-09-01 22:58:55 +02:00
#include "ggc.h"
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
#include "tree-flow.h"
#include "tree-flow-inline.h"
#include "diagnostic.h"
#include "coverage.h"
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
#include "tree.h"
#include "gcov-io.h"
Makefile.in: Adjust dependencies. 2005-07-05 Paolo Bonzini <bonzini@gnu.org> * Makefile.in: Adjust dependencies. * tree-pass.h: Add new passes and passes formerly in tree-optimize.c. * basic-block.h (duplicate_computed_gotos): Remove, it is now static. * alias.c (rest_of_handle_cfg, pass_cfg): New. * bb-reorder.c (duplicate_computed_gotos): Make it static. * cfgexpand.c (tree_expand_cfg): Add code formerly at the beginning of rest_of_compilation. * bb-reorder.c (gate_duplicate_computed_gotos, pass_duplicate_computed_gotos, gate_handle_reorder_blocks, rest_of_handle_reorder_blocks, pass_reorder_blocks, gate_handle_partition_blocks, rest_of_handle_partition_blocks, pass_partition_blocks): New. * bt-load.c (gate_handle_branch_target_load_optimize, rest_of_handle_branch_target_load_optimize, pass_branch_target_load_optimize): New. * cfgcleanup.c (rest_of_handle_jump, pass_jump, rest_of_handle_jump2, pass_jump2): New. * cfglayout.c (pass_insn_locators_initialize): New. * cfgrtl.c (pass_free_cfg): New. * combine.c (gate_handle_combine, rest_of_handle_combine, pass_combine): New. * cse.c (gate_handle_cse, rest_of_handle_cse, pass_cse, gate_handle_cse2, rest_of_handle_cse2, pass_cse2): New. * emit-rtl.c (pass_unshare_all_rtl, pass_remove_unnecessary_notes): New. * except.c (pass_set_nothrow_function_flags, pass_convert_to_eh_region_ranges, gate_handle_eh, rest_of_handle_eh, pass_rtl_eh): New. * final.c (pass_compute_alignments, rest_of_handle_final, pass_final, rest_of_handle_shorten_branches, pass_shorten_branches, rest_of_clean_state, pass_clean_state): New. * flow.c (pass_recompute_reg_usage, gate_remove_death_notes, rest_of_handle_remove_death_notes, pass_remove_death_notes, rest_of_handle_life, pass_life, rest_of_handle_flow2, pass_flow2): New. * function.c (pass_instantiate_virtual_regs, pass_init_function, rest_of_handle_check_leaf_regs, pass_leaf_regs): New. * gcse.c (gate_handle_jump_bypass, rest_of_handle_jump_bypass, pass_jump_bypass, gate_handle_gcse, rest_of_handle_gcse, pass_gcse): New. * global.c (rest_of_handle_global_alloc, pass_global_alloc): New. * ifcvt.c (gate_handle_if_conversion, rest_of_handle_if_conversion, pass_rtl_ifcvt, gate_handle_if_after_combine, rest_of_handle_if_after_combine, pass_if_after_combine, gate_handle_if_after_reload, rest_of_handle_if_after_reload, pass_if_after_reload): New. * integrate.c (pass_initial_value_sets): New. * jump.c (pass_cleanup_barriers, purge_line_number_notes, pass_purge_lineno_notes): New. * mode-switching.c (rest_of_handle_mode_switching, pass_mode_switching): New. * local-alloc.c (rest_of_handle_local_alloc, pass_local_alloc): New. * loop-init.c (gate_handle_loop2, rest_of_handle_loop2, pass_loop2): New. * loop.c (gate_handle_loop_optimize, rest_of_handle_loop_optimize, pass_loop_optimize): New. * modulo-sched.c (gate_handle_sms, rest_of_handle_sms, pass_sms): New. * postreload-gcse.c (gate_handle_gcse2, rest_of_handle_gcse2, pass_gcse2): New. * postreload.c (gate_handle_postreload, rest_of_handle_postreload, pass_postreload_cse): New. * profile.c (gate_handle_profiling, pass_profiling, rest_of_handle_branch_prob, pass_branch_prob): New. * recog.c (pass pass_split_for_shorten_branches, gate_do_final_split, pass_split_before_regstack, gate_handle_split_before_regstack, gate_handle_peephole2, rest_of_handle_peephole2, pass_peephole2, rest_of_handle_split_all_insns, pass_split_all_insns): New. * reg-stack.c (gate_handle_stack_regs, rest_of_handle_stack_regs, pass_stack_regs): New. * regmove.c (gate_handle_regmove, rest_of_handle_regmove, pass_regmove, gate_handle_stack_adjustments, rest_of_handle_stack_adjustments, pass_stack_adjustments): New. * regrename.c (gate_handle_regrename, rest_of_handle_regrename, pass_regrename): New. * reorg.c (gate_handle_delay_slots, rest_of_handle_delay_slots, pass_delay_slots, gate_handle_machine_reorg, rest_of_handle_machine_reorg, pass_machine_reorg): New. * rtl.h (extern void purge_line_number_notes): New. * sched-rgn.c (gate_handle_sched, rest_of_handle_sched, gate_handle_sched2, rest_of_handle_sched2, pass_sched, pass_sched2): New. * tracer.c (gate_handle_tracer, rest_of_handle_tracer, pass_tracer): New. * value-prof.c (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): New. * var-tracking.c (gate_handle_var_tracking, pass_variable_tracking): New. * web.c (gate_handle_web, rest_of_handle_web, pass_web): New. * passes.c (open_dump_file, close_dump_file, rest_of_handle_final, rest_of_handle_delay_slots, rest_of_handle_stack_regs, rest_of_handle_variable_tracking, rest_of_handle_machine_reorg, rest_of_handle_old_regalloc, rest_of_handle_regrename, rest_of_handle_reorder_blocks, rest_of_handle_partition_blocks, rest_of_handle_sms, rest_of_handle_sched, rest_of_handle_sched2, rest_of_handle_gcse2, rest_of_handle_regmove, rest_of_handle_tracer, rest_of_handle_if_conversion, rest_of_handle_if_after_combine, rest_of_handle_if_after_reload, rest_of_handle_web, rest_of_handle_branch_prob, rest_of_handle_value_profile_transformations, rest_of_handle_cfg, rest_of_handle_jump_bypass, rest_of_handle_combine, rest_of_handle_life, rest_of_handle_cse, rest_of_handle_cse2, rest_of_handle_gcse, rest_of_handle_loop_optimize, rest_of_handle_loop2, rest_of_handle_branch_target_load_optimize, rest_of_handle_mode_switching, rest_of_handle_jump, rest_of_handle_eh, rest_of_handle_stack_adjustments, rest_of_handle_flow2, rest_of_handle_jump2, rest_of_handle_peephole2, rest_of_handle_postreload, rest_of_handle_shorten_branches, rest_of_clean_state, rest_of_compilation): Remove. * cgraphunit.c (ipa_passes): Moved from tree-optimize.c. * passes.c (dump_flags, in_gimple_form, all_passes, all_ipa_passes, all_lowering_passes, register_one_dump_file, register_dump_files, next_pass_1, last_verified, execute_todo, execute_one_pass, execute_pass_list, execute_ipa_pass_list): Moved from tree-optimize.c. (init_optimization_passes): Moved from tree-optimize.c, adding the RTL optimizations. * tree-dump.h (dump_info_p, dump_flag): Moved from tree.h. * tree-optimize.c (dump_flags, in_gimple_form, all_passes, all_ipa_passes, all_lowering_passes, register_one_dump_file, register_dump_files, next_pass_1, last_verified, execute_todo, execute_one_pass, execute_pass_list, execute_ipa_pass_list, init_tree_optimization_passes, ipa_passes): Delete. * tree-pass.h (enum tree_dump_index): Moved from tree.h, removing the RTL dumps. (TDF_*, get_dump_file_name, dump_enabled_p, dump_initialized_p, dump_begin, dump_end, dump_node, dump_switch_p, dump_flag_name): Moved from tree.h. (ipa_passes): Remove. (all_passes, all_ipa_passes, all_lowering_passes): Now extern. * tree.h (enum tree_dump_index, TDF_*, get_dump_file_name, dump_enabled_p, dump_initialized_p, dump_begin, dump_end, dump_node, dump_switch_p, dump_flag_name): Moved to tree-pass.h. (dump_info_p, dump_flag): Moved to tree-dump.h. * Makefile.in: Adjust dependencies for tree-pretty-print.c, cgraph.c, opts.c. * passes.c (finish_optimization_passes): Use dump_begin and dump_end, TDI_end. (gate_rest_of_compilation): New. (pass_rest_of_compilation): Use it. (gate_postreload, pass_postreload): New. * toplev.c (general_init): Rename init_tree_optimization_passes. * toplev.h (init_tree_optimization_passes): Rename to init_optimizations_passes. * tree-dump.c (dump_flag): Make static. (dump_files): Remove RTL dumps. * tree-optimize.c (pass_all_optimizations, pass_early_local_passes, pass_cleanup_cfg, pass_free_cfg_annotations, pass_cleanup_cfg_post_optimizing, pass_free_datastructures, pass_init_datastructures, pass_fixup_cfg): Make non-static. * tree-pretty-print.c: Include tree-pass.h. * cgraph.c: Include tree-dump.h. cp: 2005-07-05 Paolo Bonzini <bonzini@gnu.org> * Makefile.in (class.o, decl2.o): Adjust dependencies. * class.c: Include tree-dump.h. * decl2.c: Include tree-dump.h. java: 2005-07-05 Paolo Bonzini <bonzini@gnu.org> * Makefile.in (parse.o): Adjust dependencies. * parse.y: Include tree-dump.h. From-SVN: r101627
2005-07-05 18:20:53 +02:00
#include "timevar.h"
#include "tree-pass.h"
#include "toplev.h"
static struct value_prof_hooks *value_prof_hooks;
Makefile.in (rtl-profile.o, [...]): Add GCC_H dependency. * Makefile.in (rtl-profile.o, value-prof.o): Add GCC_H dependency. * common.opt (fspeculative-prefetching): New. * flags.h (flag_speculative_prefetching_set): Declare. * gcov-io.c (gcov_write_counter, gcov_read_counter): Allow negative values. * opts.c (flag_sepculative_prefetching_set): New variable. (common_handle_option): Handle -fspeculative-prefetching. * passes.c (rest_of_compilation): Ditto. * profile.c (instrument_values, compute_value_histograms, branch_prob): Use vectors instead of arrays. * toplev.c (process_options): Handle -fspeculative-prefetching. * rtl-profile.c: Include ggc.h. (rtl_gen_interval_profiler, rtl_gen_pow2_profiler, rtl_gen_one_value_profiler_no_edge_manipulation, rtl_gen_one_value_profiler, rtl_gen_const_delta_profiler): Type of argument changed. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Type of argument changed. * value-prof.c: Include ggc.h. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX): New macros. (insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, gen_speculative_prefetch, speculative_prefetching_transform): New. (value_profile_transformations): Call speculative_prefetching_transform. (insn_values_to_profile): Call insn_prefetch_values_to_profile. (insn_divmod_values_to_profile, rtl_find_values_to_profile, tree_find_values_to_profile, find_values to profile): Use vectors instead of arrays. (free_profiled_values): Removed. * value-prof.h (struct histogram_value): Renamed to struct histogram_value_t. (histogram_value, histogram_values): New types. (find_values_to_profile): Declaration changed. (free_profiled_values): Removed. (struct profile_hooks): Type of argument of the hooks changed to histogram_value. * doc/invoke.texi (-fspeculative-prefetching): Document. From-SVN: r86930
2004-09-01 22:58:55 +02:00
/* In this file value profile based optimizations are placed. Currently the
following optimizations are implemented (for more detailed descriptions
see comments at value_profile_transformations):
1) Division/modulo specialization. Provided that we can determine that the
Makefile.in (rtl-profile.o, [...]): Add GCC_H dependency. * Makefile.in (rtl-profile.o, value-prof.o): Add GCC_H dependency. * common.opt (fspeculative-prefetching): New. * flags.h (flag_speculative_prefetching_set): Declare. * gcov-io.c (gcov_write_counter, gcov_read_counter): Allow negative values. * opts.c (flag_sepculative_prefetching_set): New variable. (common_handle_option): Handle -fspeculative-prefetching. * passes.c (rest_of_compilation): Ditto. * profile.c (instrument_values, compute_value_histograms, branch_prob): Use vectors instead of arrays. * toplev.c (process_options): Handle -fspeculative-prefetching. * rtl-profile.c: Include ggc.h. (rtl_gen_interval_profiler, rtl_gen_pow2_profiler, rtl_gen_one_value_profiler_no_edge_manipulation, rtl_gen_one_value_profiler, rtl_gen_const_delta_profiler): Type of argument changed. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Type of argument changed. * value-prof.c: Include ggc.h. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX): New macros. (insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, gen_speculative_prefetch, speculative_prefetching_transform): New. (value_profile_transformations): Call speculative_prefetching_transform. (insn_values_to_profile): Call insn_prefetch_values_to_profile. (insn_divmod_values_to_profile, rtl_find_values_to_profile, tree_find_values_to_profile, find_values to profile): Use vectors instead of arrays. (free_profiled_values): Removed. * value-prof.h (struct histogram_value): Renamed to struct histogram_value_t. (histogram_value, histogram_values): New types. (find_values_to_profile): Declaration changed. (free_profiled_values): Removed. (struct profile_hooks): Type of argument of the hooks changed to histogram_value. * doc/invoke.texi (-fspeculative-prefetching): Document. From-SVN: r86930
2004-09-01 22:58:55 +02:00
operands of the division have some special properties, we may use it to
produce more effective code.
2) Speculative prefetching. If we are able to determine that the difference
between addresses accessed by a memory reference is usually constant, we
may add the prefetch instructions.
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
FIXME: This transformation was removed together with RTL based value
profiling.
Every such optimization should add its requirements for profiled values to
insn_values_to_profile function. This function is called from branch_prob
in profile.c and the requested values are instrumented by it in the first
compilation with -fprofile-arcs. The optimization may then read the
gathered data in the second compilation with -fbranch-probabilities.
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
The measured data is pointed to from the histograms
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
field of the statement annotation of the instrumented insns. It is
kept as a linked list of struct histogram_value_t's, which contain the
same information as above. */
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
static tree tree_divmod_fixed_value (tree, tree, tree, tree,
tree, int, gcov_type, gcov_type);
static tree tree_mod_pow2 (tree, tree, tree, tree, int, gcov_type, gcov_type);
static tree tree_mod_subtract (tree, tree, tree, tree, int, int, int,
gcov_type, gcov_type, gcov_type);
static bool tree_divmod_fixed_value_transform (tree);
static bool tree_mod_pow2_value_transform (tree);
static bool tree_mod_subtract_transform (tree);
static bool tree_stringops_transform (block_stmt_iterator *);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
/* The overall number of invocations of the counter should match execution count
of basic block. Report it as error rather than internal error as it might
mean that user has misused the profile somehow. */
static bool
check_counter (tree stmt, const char * name, gcov_type all, gcov_type bb_count)
{
if (all != bb_count)
{
location_t * locus;
locus = (stmt != NULL && EXPR_HAS_LOCATION (stmt)
? EXPR_LOCUS (stmt)
: &DECL_SOURCE_LOCATION (current_function_decl));
error ("%HCorrupted value profile: %s profiler overall count (%d) does not match BB count (%d)",
locus, name, (int)all, (int)bb_count);
return true;
}
return false;
}
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
/* Tree based transformations. */
static bool
tree_value_profile_transformations (void)
{
basic_block bb;
block_stmt_iterator bsi;
bool changed = false;
FOR_EACH_BB (bb)
{
/* Ignore cold areas -- we are enlarging the code. */
if (!bb->count || !maybe_hot_bb_p (bb))
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
continue;
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
stmt_ann_t ann = get_stmt_ann (stmt);
histogram_value th = ann->histograms;
if (!th)
continue;
if (dump_file)
{
fprintf (dump_file, "Trying transformations on insn ");
print_generic_stmt (dump_file, stmt, TDF_SLIM);
}
/* Transformations: */
/* The order of things in this conditional controls which
transformation is used when more than one is applicable. */
/* It is expected that any code added by the transformations
will be added before the current statement, and that the
current statement remain valid (although possibly
modified) upon return. */
if (flag_value_profile_transformations
&& (tree_mod_subtract_transform (stmt)
|| tree_divmod_fixed_value_transform (stmt)
|| tree_mod_pow2_value_transform (stmt)
|| tree_stringops_transform (&bsi)))
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
{
stmt = bsi_stmt (bsi);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
changed = true;
/* Original statement may no longer be in the same block. */
if (bb != bb_for_stmt (stmt))
{
bb = bb_for_stmt (stmt);
bsi = bsi_for_stmt (stmt);
}
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
}
/* Free extra storage from compute_value_histograms. */
while (th)
{
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
free (th->hvalue.counters);
th = th->hvalue.next;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
}
ann->histograms = 0;
}
}
if (changed)
{
counts_to_freqs ();
}
return changed;
}
/* Generate code for transformation 1 (with OPERATION, operands OP1
and OP2, whose value is expected to be VALUE, parent modify-expr STMT and
probability of taking the optimal path PROB, which is equivalent to COUNT/ALL
within roundoff error). This generates the result into a temp and returns
the temp; it does not replace or alter the original STMT. */
static tree
tree_divmod_fixed_value (tree stmt, tree operation,
tree op1, tree op2, tree value, int prob, gcov_type count,
gcov_type all)
{
tree stmt1, stmt2, stmt3;
tree tmp1, tmp2, tmpv;
tree label_decl1 = create_artificial_label ();
tree label_decl2 = create_artificial_label ();
tree label1, label2;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
tree bb1end, bb2end, bb3end;
basic_block bb, bb2, bb3, bb4;
tree optype = TREE_TYPE (operation);
edge e12, e13, e23, e24, e34;
block_stmt_iterator bsi;
bb = bb_for_stmt (stmt);
bsi = bsi_for_stmt (stmt);
tmpv = create_tmp_var (optype, "PROF");
tmp1 = create_tmp_var (optype, "PROF");
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, tmpv,
fold_convert (optype, value));
stmt2 = build2 (GIMPLE_MODIFY_STMT, optype, tmp1, op2);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
stmt3 = build3 (COND_EXPR, void_type_node,
build2 (NE_EXPR, boolean_type_node, tmp1, tmpv),
build1 (GOTO_EXPR, void_type_node, label_decl2),
build1 (GOTO_EXPR, void_type_node, label_decl1));
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
bb1end = stmt3;
tmp2 = create_tmp_var (optype, "PROF");
label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, tmp2,
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
build2 (TREE_CODE (operation), optype, op1, tmpv));
bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bb2end = stmt1;
label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, tmp2,
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
build2 (TREE_CODE (operation), optype, op1, op2));
bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bb3end = stmt1;
/* Fix CFG. */
/* Edge e23 connects bb2 to bb3, etc. */
e12 = split_block (bb, bb1end);
bb2 = e12->dest;
bb2->count = count;
e23 = split_block (bb2, bb2end);
bb3 = e23->dest;
bb3->count = all - count;
e34 = split_block (bb3, bb3end);
bb4 = e34->dest;
bb4->count = all;
e12->flags &= ~EDGE_FALLTHRU;
e12->flags |= EDGE_FALSE_VALUE;
e12->probability = prob;
e12->count = count;
e13 = make_edge (bb, bb3, EDGE_TRUE_VALUE);
e13->probability = REG_BR_PROB_BASE - prob;
e13->count = all - count;
remove_edge (e23);
e24 = make_edge (bb2, bb4, EDGE_FALLTHRU);
e24->probability = REG_BR_PROB_BASE;
e24->count = count;
e34->probability = REG_BR_PROB_BASE;
e34->count = all - count;
return tmp2;
}
/* Do transform 1) on INSN if applicable. */
static bool
tree_divmod_fixed_value_transform (tree stmt)
{
stmt_ann_t ann = get_stmt_ann (stmt);
histogram_value histogram;
enum tree_code code;
gcov_type val, count, all;
tree modify, op, op1, op2, result, value, tree_val;
int prob;
modify = stmt;
if (TREE_CODE (stmt) == RETURN_EXPR
&& TREE_OPERAND (stmt, 0)
&& TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
modify = TREE_OPERAND (stmt, 0);
if (TREE_CODE (modify) != GIMPLE_MODIFY_STMT)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
return false;
op = GIMPLE_STMT_OPERAND (modify, 1);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
if (!INTEGRAL_TYPE_P (TREE_TYPE (op)))
return false;
code = TREE_CODE (op);
if (code != TRUNC_DIV_EXPR && code != TRUNC_MOD_EXPR)
return false;
op1 = TREE_OPERAND (op, 0);
op2 = TREE_OPERAND (op, 1);
if (!ann->histograms)
return false;
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
for (histogram = ann->histograms; histogram; histogram = histogram->hvalue.next)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
if (histogram->type == HIST_TYPE_SINGLE_VALUE)
break;
if (!histogram)
return false;
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
value = histogram->hvalue.value;
val = histogram->hvalue.counters[0];
count = histogram->hvalue.counters[1];
all = histogram->hvalue.counters[2];
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
/* We require that count is at least half of all; this means
that for the transformation to fire the value must be constant
at least 50% of time (and 75% gives the guarantee of usage). */
if (simple_cst_equal (op2, value) != 1 || 2 * count < all)
return false;
if (check_counter (stmt, "value", all, bb_for_stmt (stmt)->count))
return false;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
/* Compute probability of taking the optimal path. */
prob = (count * REG_BR_PROB_BASE + all / 2) / all;
tree_val = build_int_cst_wide (get_gcov_type (),
(unsigned HOST_WIDE_INT) val,
val >> (HOST_BITS_PER_WIDE_INT - 1) >> 1);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
result = tree_divmod_fixed_value (stmt, op, op1, op2, tree_val, prob, count, all);
if (dump_file)
{
fprintf (dump_file, "Div/mod by constant ");
print_generic_expr (dump_file, value, TDF_SLIM);
fprintf (dump_file, "=");
print_generic_expr (dump_file, tree_val, TDF_SLIM);
fprintf (dump_file, " transformation on insn ");
print_generic_stmt (dump_file, stmt, TDF_SLIM);
}
GIMPLE_STMT_OPERAND (modify, 1) = result;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
return true;
}
/* Generate code for transformation 2 (with OPERATION, operands OP1
and OP2, parent modify-expr STMT and probability of taking the optimal
path PROB, which is equivalent to COUNT/ALL within roundoff error).
This generates the result into a temp and returns
the temp; it does not replace or alter the original STMT. */
static tree
tree_mod_pow2 (tree stmt, tree operation, tree op1, tree op2, int prob,
gcov_type count, gcov_type all)
{
tree stmt1, stmt2, stmt3, stmt4;
tree tmp2, tmp3;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
tree label_decl1 = create_artificial_label ();
tree label_decl2 = create_artificial_label ();
tree label1, label2;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
tree bb1end, bb2end, bb3end;
basic_block bb, bb2, bb3, bb4;
tree optype = TREE_TYPE (operation);
edge e12, e13, e23, e24, e34;
block_stmt_iterator bsi;
tree result = create_tmp_var (optype, "PROF");
bb = bb_for_stmt (stmt);
bsi = bsi_for_stmt (stmt);
tmp2 = create_tmp_var (optype, "PROF");
tmp3 = create_tmp_var (optype, "PROF");
stmt2 = build2 (GIMPLE_MODIFY_STMT, optype, tmp2,
build2 (PLUS_EXPR, optype, op2, build_int_cst (optype, -1)));
stmt3 = build2 (GIMPLE_MODIFY_STMT, optype, tmp3,
build2 (BIT_AND_EXPR, optype, tmp2, op2));
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
stmt4 = build3 (COND_EXPR, void_type_node,
build2 (NE_EXPR, boolean_type_node,
tmp3, build_int_cst (optype, 0)),
build1 (GOTO_EXPR, void_type_node, label_decl2),
build1 (GOTO_EXPR, void_type_node, label_decl1));
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt4, BSI_SAME_STMT);
bb1end = stmt4;
/* tmp2 == op2-1 inherited from previous block */
label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, result,
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
build2 (BIT_AND_EXPR, optype, op1, tmp2));
bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bb2end = stmt1;
label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, result,
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
build2 (TREE_CODE (operation), optype, op1, op2));
bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bb3end = stmt1;
/* Fix CFG. */
/* Edge e23 connects bb2 to bb3, etc. */
e12 = split_block (bb, bb1end);
bb2 = e12->dest;
bb2->count = count;
e23 = split_block (bb2, bb2end);
bb3 = e23->dest;
bb3->count = all - count;
e34 = split_block (bb3, bb3end);
bb4 = e34->dest;
bb4->count = all;
e12->flags &= ~EDGE_FALLTHRU;
e12->flags |= EDGE_FALSE_VALUE;
e12->probability = prob;
e12->count = count;
e13 = make_edge (bb, bb3, EDGE_TRUE_VALUE);
e13->probability = REG_BR_PROB_BASE - prob;
e13->count = all - count;
remove_edge (e23);
e24 = make_edge (bb2, bb4, EDGE_FALLTHRU);
e24->probability = REG_BR_PROB_BASE;
e24->count = count;
e34->probability = REG_BR_PROB_BASE;
e34->count = all - count;
return result;
}
/* Do transform 2) on INSN if applicable. */
static bool
tree_mod_pow2_value_transform (tree stmt)
{
stmt_ann_t ann = get_stmt_ann (stmt);
histogram_value histogram;
enum tree_code code;
gcov_type count, wrong_values, all;
tree modify, op, op1, op2, result, value;
int prob;
modify = stmt;
if (TREE_CODE (stmt) == RETURN_EXPR
&& TREE_OPERAND (stmt, 0)
&& TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
modify = TREE_OPERAND (stmt, 0);
if (TREE_CODE (modify) != GIMPLE_MODIFY_STMT)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
return false;
op = GIMPLE_STMT_OPERAND (modify, 1);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
if (!INTEGRAL_TYPE_P (TREE_TYPE (op)))
return false;
code = TREE_CODE (op);
if (code != TRUNC_MOD_EXPR || !TYPE_UNSIGNED (TREE_TYPE (op)))
return false;
op1 = TREE_OPERAND (op, 0);
op2 = TREE_OPERAND (op, 1);
if (!ann->histograms)
return false;
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
for (histogram = ann->histograms; histogram; histogram = histogram->hvalue.next)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
if (histogram->type == HIST_TYPE_POW2)
break;
if (!histogram)
return false;
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
value = histogram->hvalue.value;
wrong_values = histogram->hvalue.counters[0];
count = histogram->hvalue.counters[1];
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
/* We require that we hit a power of 2 at least half of all evaluations. */
if (simple_cst_equal (op2, value) != 1 || count < wrong_values)
return false;
if (dump_file)
{
fprintf (dump_file, "Mod power of 2 transformation on insn ");
print_generic_stmt (dump_file, stmt, TDF_SLIM);
}
/* Compute probability of taking the optimal path. */
all = count + wrong_values;
if (check_counter (stmt, "pow2", all, bb_for_stmt (stmt)->count))
return false;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
prob = (count * REG_BR_PROB_BASE + all / 2) / all;
result = tree_mod_pow2 (stmt, op, op1, op2, prob, count, all);
GIMPLE_STMT_OPERAND (modify, 1) = result;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
return true;
}
/* Generate code for transformations 3 and 4 (with OPERATION, operands OP1
and OP2, parent modify-expr STMT, and NCOUNTS the number of cases to
support. Currently only NCOUNTS==0 or 1 is supported and this is
built into this interface. The probabilities of taking the optimal
paths are PROB1 and PROB2, which are equivalent to COUNT1/ALL and
COUNT2/ALL respectively within roundoff error). This generates the
result into a temp and returns the temp; it does not replace or alter
the original STMT. */
/* FIXME: Generalize the interface to handle NCOUNTS > 1. */
static tree
tree_mod_subtract (tree stmt, tree operation, tree op1, tree op2,
int prob1, int prob2, int ncounts,
gcov_type count1, gcov_type count2, gcov_type all)
{
tree stmt1, stmt2, stmt3;
tree tmp1;
tree label_decl1 = create_artificial_label ();
tree label_decl2 = create_artificial_label ();
tree label_decl3 = create_artificial_label ();
tree label1, label2, label3;
tree bb1end, bb2end = NULL_TREE, bb3end;
basic_block bb, bb2, bb3, bb4;
tree optype = TREE_TYPE (operation);
edge e12, e23 = 0, e24, e34, e14;
block_stmt_iterator bsi;
tree result = create_tmp_var (optype, "PROF");
bb = bb_for_stmt (stmt);
bsi = bsi_for_stmt (stmt);
tmp1 = create_tmp_var (optype, "PROF");
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, result, op1);
stmt2 = build2 (GIMPLE_MODIFY_STMT, optype, tmp1, op2);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
stmt3 = build3 (COND_EXPR, void_type_node,
build2 (LT_EXPR, boolean_type_node, result, tmp1),
build1 (GOTO_EXPR, void_type_node, label_decl3),
build1 (GOTO_EXPR, void_type_node,
ncounts ? label_decl1 : label_decl2));
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
bb1end = stmt3;
if (ncounts) /* Assumed to be 0 or 1 */
{
label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, result,
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
build2 (MINUS_EXPR, optype, result, tmp1));
stmt2 = build3 (COND_EXPR, void_type_node,
build2 (LT_EXPR, boolean_type_node, result, tmp1),
build1 (GOTO_EXPR, void_type_node, label_decl3),
build1 (GOTO_EXPR, void_type_node, label_decl2));
bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
bb2end = stmt2;
}
/* Fallback case. */
label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, result,
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
build2 (TREE_CODE (operation), optype, result, tmp1));
bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bb3end = stmt1;
label3 = build1 (LABEL_EXPR, void_type_node, label_decl3);
bsi_insert_before (&bsi, label3, BSI_SAME_STMT);
/* Fix CFG. */
/* Edge e23 connects bb2 to bb3, etc. */
/* However block 3 is optional; if it is not there, references
to 3 really refer to block 2. */
e12 = split_block (bb, bb1end);
bb2 = e12->dest;
bb2->count = all - count1;
if (ncounts) /* Assumed to be 0 or 1. */
{
e23 = split_block (bb2, bb2end);
bb3 = e23->dest;
bb3->count = all - count1 - count2;
}
e34 = split_block (ncounts ? bb3 : bb2, bb3end);
bb4 = e34->dest;
bb4->count = all;
e12->flags &= ~EDGE_FALLTHRU;
e12->flags |= EDGE_FALSE_VALUE;
e12->probability = REG_BR_PROB_BASE - prob1;
e12->count = all - count1;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
e14 = make_edge (bb, bb4, EDGE_TRUE_VALUE);
e14->probability = prob1;
e14->count = count1;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
if (ncounts) /* Assumed to be 0 or 1. */
{
e23->flags &= ~EDGE_FALLTHRU;
e23->flags |= EDGE_FALSE_VALUE;
e23->count = all - count1 - count2;
e23->probability = REG_BR_PROB_BASE - prob2;
e24 = make_edge (bb2, bb4, EDGE_TRUE_VALUE);
e24->probability = prob2;
e24->count = count2;
}
e34->probability = REG_BR_PROB_BASE;
e34->count = all - count1 - count2;
return result;
}
/* Do transforms 3) and 4) on INSN if applicable. */
static bool
tree_mod_subtract_transform (tree stmt)
{
stmt_ann_t ann = get_stmt_ann (stmt);
histogram_value histogram;
enum tree_code code;
gcov_type count, wrong_values, all;
tree modify, op, op1, op2, result, value;
int prob1, prob2;
unsigned int i;
modify = stmt;
if (TREE_CODE (stmt) == RETURN_EXPR
&& TREE_OPERAND (stmt, 0)
&& TREE_CODE (TREE_OPERAND (stmt, 0)) == GIMPLE_MODIFY_STMT)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
modify = TREE_OPERAND (stmt, 0);
if (TREE_CODE (modify) != GIMPLE_MODIFY_STMT)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
return false;
op = GIMPLE_STMT_OPERAND (modify, 1);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
if (!INTEGRAL_TYPE_P (TREE_TYPE (op)))
return false;
code = TREE_CODE (op);
if (code != TRUNC_MOD_EXPR || !TYPE_UNSIGNED (TREE_TYPE (op)))
return false;
op1 = TREE_OPERAND (op, 0);
op2 = TREE_OPERAND (op, 1);
if (!ann->histograms)
return false;
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
for (histogram = ann->histograms; histogram; histogram = histogram->hvalue.next)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
if (histogram->type == HIST_TYPE_INTERVAL)
break;
if (!histogram)
return false;
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
value = histogram->hvalue.value;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
all = 0;
wrong_values = 0;
for (i = 0; i < histogram->hdata.intvl.steps; i++)
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
all += histogram->hvalue.counters[i];
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
wrong_values += histogram->hvalue.counters[i];
wrong_values += histogram->hvalue.counters[i+1];
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
all += wrong_values;
/* Compute probability of taking the optimal path. */
if (check_counter (stmt, "interval", all, bb_for_stmt (stmt)->count))
return false;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
/* We require that we use just subtractions in at least 50% of all
evaluations. */
count = 0;
for (i = 0; i < histogram->hdata.intvl.steps; i++)
{
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
count += histogram->hvalue.counters[i];
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
if (count * 2 >= all)
break;
}
if (i == histogram->hdata.intvl.steps)
return false;
if (dump_file)
{
fprintf (dump_file, "Mod subtract transformation on insn ");
print_generic_stmt (dump_file, stmt, TDF_SLIM);
}
/* Compute probability of taking the optimal path(s). */
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
prob1 = (histogram->hvalue.counters[0] * REG_BR_PROB_BASE + all / 2) / all;
prob2 = (histogram->hvalue.counters[1] * REG_BR_PROB_BASE + all / 2) / all;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
/* In practice, "steps" is always 2. This interface reflects this,
and will need to be changed if "steps" can change. */
result = tree_mod_subtract (stmt, op, op1, op2, prob1, prob2, i,
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
histogram->hvalue.counters[0],
histogram->hvalue.counters[1], all);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
GIMPLE_STMT_OPERAND (modify, 1) = result;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
return true;
}
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
/* Return true if the stringop FNDECL with ARGLIST shall be profiled. */
static bool
interesting_stringop_to_profile_p (tree fndecl, tree arglist)
{
enum built_in_function fcode = DECL_FUNCTION_CODE (fndecl);
if (fcode != BUILT_IN_MEMSET && fcode != BUILT_IN_MEMCPY
&& fcode != BUILT_IN_BZERO)
return false;
switch (fcode)
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMPCPY:
return validate_arglist (arglist,
POINTER_TYPE, POINTER_TYPE, INTEGER_TYPE,
VOID_TYPE);
case BUILT_IN_MEMSET:
return validate_arglist (arglist,
POINTER_TYPE, INTEGER_TYPE, INTEGER_TYPE,
VOID_TYPE);
case BUILT_IN_BZERO:
return validate_arglist (arglist, POINTER_TYPE, INTEGER_TYPE,
VOID_TYPE);
default:
gcc_unreachable ();
}
}
/* Convert stringop (..., size)
into
if (size == VALUE)
stringop (...., VALUE);
else
stringop (...., size);
assuming constant propagation of VALUE will happen later.
*/
static void
tree_stringop_fixed_value (tree stmt, tree value, int prob, gcov_type count,
gcov_type all)
{
tree stmt1, stmt2, stmt3;
tree tmp1, tmpv;
tree label_decl1 = create_artificial_label ();
tree label_decl2 = create_artificial_label ();
tree label1, label2;
tree bb1end, bb2end;
basic_block bb, bb2, bb3, bb4;
edge e12, e13, e23, e24, e34;
block_stmt_iterator bsi;
tree call = get_call_expr_in (stmt);
tree arglist = TREE_OPERAND (call, 1);
tree blck_size = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
tree optype = TREE_TYPE (blck_size);
int region;
bb = bb_for_stmt (stmt);
bsi = bsi_for_stmt (stmt);
if (bsi_end_p (bsi))
{
edge_iterator ei;
for (ei = ei_start (bb->succs); (e34 = ei_safe_edge (ei)); )
if (!e34->flags & EDGE_ABNORMAL)
break;
}
else
{
e34 = split_block (bb, stmt);
bsi = bsi_for_stmt (stmt);
}
bb4 = e34->dest;
tmpv = create_tmp_var (optype, "PROF");
tmp1 = create_tmp_var (optype, "PROF");
stmt1 = build2 (GIMPLE_MODIFY_STMT, optype, tmpv,
fold_convert (optype, value));
stmt2 = build2 (GIMPLE_MODIFY_STMT, optype, tmp1, blck_size);
stmt3 = build3 (COND_EXPR, void_type_node,
build2 (NE_EXPR, boolean_type_node, tmp1, tmpv),
build1 (GOTO_EXPR, void_type_node, label_decl2),
build1 (GOTO_EXPR, void_type_node, label_decl1));
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt2, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt3, BSI_SAME_STMT);
bb1end = stmt3;
label1 = build1 (LABEL_EXPR, void_type_node, label_decl1);
stmt1 = unshare_expr (stmt);
call = get_call_expr_in (stmt1);
arglist = TREE_OPERAND (call, 1);
TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist))) = value;
bsi_insert_before (&bsi, label1, BSI_SAME_STMT);
bsi_insert_before (&bsi, stmt1, BSI_SAME_STMT);
region = lookup_stmt_eh_region (stmt);
if (region >= 0)
add_stmt_to_eh_region (stmt1, region);
bb2end = stmt1;
label2 = build1 (LABEL_EXPR, void_type_node, label_decl2);
bsi_insert_before (&bsi, label2, BSI_SAME_STMT);
/* Fix CFG. */
/* Edge e23 connects bb2 to bb3, etc. */
e12 = split_block (bb, bb1end);
bb2 = e12->dest;
bb2->count = count;
e23 = split_block (bb2, bb2end);
bb3 = e23->dest;
bb3->count = all - count;
e12->flags &= ~EDGE_FALLTHRU;
e12->flags |= EDGE_FALSE_VALUE;
e12->probability = prob;
e12->count = count;
e13 = make_edge (bb, bb3, EDGE_TRUE_VALUE);
e13->probability = REG_BR_PROB_BASE - prob;
e13->count = all - count;
remove_edge (e23);
e24 = make_edge (bb2, bb4, EDGE_FALLTHRU);
e24->probability = REG_BR_PROB_BASE;
e24->count = count;
e34->probability = REG_BR_PROB_BASE;
e34->count = all - count;
}
/* Find values inside STMT for that we want to measure histograms for
division/modulo optimization. */
static bool
tree_stringops_transform (block_stmt_iterator *bsi)
{
tree stmt = bsi_stmt (*bsi);
tree call = get_call_expr_in (stmt);
tree fndecl;
tree arglist;
tree blck_size;
enum built_in_function fcode;
stmt_ann_t ann = get_stmt_ann (stmt);
histogram_value histogram;
gcov_type count, all, val;
tree value;
tree dest, src;
unsigned int dest_align, src_align;
int prob;
tree tree_val;
if (!call)
return false;
fndecl = get_callee_fndecl (call);
if (!fndecl)
return false;
fcode = DECL_FUNCTION_CODE (fndecl);
arglist = TREE_OPERAND (call, 1);
if (!interesting_stringop_to_profile_p (fndecl, arglist))
return false;
if (fcode == BUILT_IN_BZERO)
blck_size = TREE_VALUE (TREE_CHAIN (arglist));
else
blck_size = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
if (TREE_CODE (blck_size) == INTEGER_CST)
return false;
if (!ann->histograms)
return false;
all = bb_for_stmt (stmt)->count;
if (!all)
return false;
for (histogram = ann->histograms; histogram;
histogram = histogram->hvalue.next)
if (histogram->type == HIST_TYPE_SINGLE_VALUE)
break;
if (!histogram)
return false;
value = histogram->hvalue.value;
val = histogram->hvalue.counters[0];
count = histogram->hvalue.counters[1];
all = histogram->hvalue.counters[2];
/* We require that count is at least half of all; this means
that for the transformation to fire the value must be constant
at least 80% of time. */
if ((6 * count / 5) < all)
return false;
if (check_counter (stmt, "value", all, bb_for_stmt (stmt)->count))
return false;
prob = (count * REG_BR_PROB_BASE + all / 2) / all;
dest = TREE_VALUE (arglist);
dest_align = get_pointer_alignment (dest, BIGGEST_ALIGNMENT);
switch (fcode)
{
case BUILT_IN_MEMCPY:
case BUILT_IN_MEMPCPY:
src = TREE_VALUE (TREE_CHAIN (arglist));
src_align = get_pointer_alignment (src, BIGGEST_ALIGNMENT);
if (!can_move_by_pieces (val, MIN (dest_align, src_align)))
return false;
break;
case BUILT_IN_MEMSET:
if (!can_store_by_pieces (val, builtin_memset_read_str,
TREE_VALUE (TREE_CHAIN (arglist)),
dest_align))
return false;
break;
case BUILT_IN_BZERO:
if (!can_store_by_pieces (val, builtin_memset_read_str,
integer_zero_node,
dest_align))
return false;
break;
default:
gcc_unreachable ();
}
tree_val = build_int_cst_wide (get_gcov_type (),
(unsigned HOST_WIDE_INT) val,
val >> (HOST_BITS_PER_WIDE_INT - 1) >> 1);
if (dump_file)
{
fprintf (dump_file, "Single value %i stringop transformation on ",
(int)val);
print_generic_stmt (dump_file, stmt, TDF_SLIM);
}
tree_stringop_fixed_value (stmt, tree_val, prob, count, all);
return true;
}
struct value_prof_hooks {
/* Find list of values for which we want to measure histograms. */
Makefile.in (rtl-profile.o, [...]): Add GCC_H dependency. * Makefile.in (rtl-profile.o, value-prof.o): Add GCC_H dependency. * common.opt (fspeculative-prefetching): New. * flags.h (flag_speculative_prefetching_set): Declare. * gcov-io.c (gcov_write_counter, gcov_read_counter): Allow negative values. * opts.c (flag_sepculative_prefetching_set): New variable. (common_handle_option): Handle -fspeculative-prefetching. * passes.c (rest_of_compilation): Ditto. * profile.c (instrument_values, compute_value_histograms, branch_prob): Use vectors instead of arrays. * toplev.c (process_options): Handle -fspeculative-prefetching. * rtl-profile.c: Include ggc.h. (rtl_gen_interval_profiler, rtl_gen_pow2_profiler, rtl_gen_one_value_profiler_no_edge_manipulation, rtl_gen_one_value_profiler, rtl_gen_const_delta_profiler): Type of argument changed. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Type of argument changed. * value-prof.c: Include ggc.h. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX): New macros. (insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, gen_speculative_prefetch, speculative_prefetching_transform): New. (value_profile_transformations): Call speculative_prefetching_transform. (insn_values_to_profile): Call insn_prefetch_values_to_profile. (insn_divmod_values_to_profile, rtl_find_values_to_profile, tree_find_values_to_profile, find_values to profile): Use vectors instead of arrays. (free_profiled_values): Removed. * value-prof.h (struct histogram_value): Renamed to struct histogram_value_t. (histogram_value, histogram_values): New types. (find_values_to_profile): Declaration changed. (free_profiled_values): Removed. (struct profile_hooks): Type of argument of the hooks changed to histogram_value. * doc/invoke.texi (-fspeculative-prefetching): Document. From-SVN: r86930
2004-09-01 22:58:55 +02:00
void (*find_values_to_profile) (histogram_values *);
/* Identify and exploit properties of values that are hard to analyze
statically. See value-prof.c for more detail. */
bool (*value_profile_transformations) (void);
};
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
/* Find values inside STMT for that we want to measure histograms for
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
division/modulo optimization. */
static void
tree_divmod_values_to_profile (tree stmt, histogram_values *values)
{
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
tree assign, lhs, rhs, divisor, op0, type;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
histogram_value hist;
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
if (TREE_CODE (stmt) == RETURN_EXPR)
assign = TREE_OPERAND (stmt, 0);
else
assign = stmt;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
if (!assign
|| TREE_CODE (assign) != GIMPLE_MODIFY_STMT)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
return;
lhs = GIMPLE_STMT_OPERAND (assign, 0);
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
type = TREE_TYPE (lhs);
if (!INTEGRAL_TYPE_P (type))
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
return;
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
rhs = GIMPLE_STMT_OPERAND (assign, 1);
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
switch (TREE_CODE (rhs))
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
{
case TRUNC_DIV_EXPR:
case TRUNC_MOD_EXPR:
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
divisor = TREE_OPERAND (rhs, 1);
op0 = TREE_OPERAND (rhs, 0);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_reserve (histogram_value, heap, *values, 3);
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
if (is_gimple_reg (divisor))
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
{
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
/* Check for the case where the divisor is the same value most
of the time. */
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
hist = ggc_alloc (sizeof (*hist));
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
hist->hvalue.value = divisor;
hist->hvalue.stmt = stmt;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
hist->type = HIST_TYPE_SINGLE_VALUE;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_quick_push (histogram_value, *values, hist);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
}
/* For mod, check whether it is not often a noop (or replaceable by
a few subtractions). */
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
if (TREE_CODE (rhs) == TRUNC_MOD_EXPR
&& TYPE_UNSIGNED (type))
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
{
/* Check for a special case where the divisor is power of 2. */
hist = ggc_alloc (sizeof (*hist));
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
hist->hvalue.value = divisor;
hist->hvalue.stmt = stmt;
hist->type = HIST_TYPE_POW2;
VEC_quick_push (histogram_value, *values, hist);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
hist = ggc_alloc (sizeof (*hist));
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
hist->hvalue.stmt = stmt;
hist->hvalue.value
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
= build2 (TRUNC_DIV_EXPR, type, op0, divisor);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
hist->type = HIST_TYPE_INTERVAL;
hist->hdata.intvl.int_start = 0;
hist->hdata.intvl.steps = 2;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
VEC_quick_push (histogram_value, *values, hist);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
}
return;
default:
return;
}
}
/* Find values inside STMT for that we want to measure histograms for
division/modulo optimization. */
static void
tree_stringops_values_to_profile (tree stmt, histogram_values *values)
{
tree call = get_call_expr_in (stmt);
tree fndecl;
tree arglist;
tree blck_size;
enum built_in_function fcode;
histogram_value hist;
if (!call)
return;
fndecl = get_callee_fndecl (call);
if (!fndecl)
return;
fcode = DECL_FUNCTION_CODE (fndecl);
arglist = TREE_OPERAND (call, 1);
if (!interesting_stringop_to_profile_p (fndecl, arglist))
return;
if (fcode == BUILT_IN_BZERO)
blck_size = TREE_VALUE (TREE_CHAIN (arglist));
else
blck_size = TREE_VALUE (TREE_CHAIN (TREE_CHAIN (arglist)));
if (TREE_CODE (blck_size) != INTEGER_CST)
{
VEC_reserve (histogram_value, heap, *values, 3);
hist = ggc_alloc (sizeof (*hist));
hist->hvalue.value = blck_size;
hist->hvalue.stmt = stmt;
hist->type = HIST_TYPE_SINGLE_VALUE;
VEC_quick_push (histogram_value, *values, hist);
}
}
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
/* Find values inside STMT for that we want to measure histograms and adds
them to list VALUES. */
static void
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
tree_values_to_profile (tree stmt, histogram_values *values)
{
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
if (flag_value_profile_transformations)
{
tree_divmod_values_to_profile (stmt, values);
tree_stringops_values_to_profile (stmt, values);
}
}
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
static void
tree_find_values_to_profile (histogram_values *values)
{
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
basic_block bb;
block_stmt_iterator bsi;
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
unsigned i;
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
histogram_value hist;
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
*values = NULL;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
FOR_EACH_BB (bb)
for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
tree_values_to_profile (bsi_stmt (bsi), values);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
vec.h: Update API to separate allocation mechanism from type. * vec.h: Update API to separate allocation mechanism from type. (VEC_safe_grow): New. * vec.c (calculate_allocation): New. (vec_gc_o_reserve, vec_heap_o_reserve): Adjust. (vec_gc_free, vec_heap_free): Remove. * gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust. (VEC): Likewise. (mangle_macro_name): New. (struct macro_def): New. (struct macro): Add multiple argument values. (macro_expans_end): New. (push_macro_expansion): Chain on new macro. Process multiple args, create follow on expansion. Return follow on argument. (macro_input): Deal with multiple arguments. * tree.h: Define VEC(tree,heap) and VEC(tree,gc). (struct tree_binfo): Adjust. * basic-block.h: Define VEC(edge,gc). (struct edge_def): Adjust. (struct basic_block_def, struct edge_iterator): Likewise. (ei_container, ei_start_1, ei_last_1): Likewise. * cfg.c (connect_src, connect_dest): Likewise. * cfgrtl.c (force_nonfallthru_and_redirect) * dbxout.c (dbxout_type) * dwarf2out.c (gen_member_die) * lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc). (gcc_tree_to_linear_expression): Adjust. (gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest, lbv_to_gcc_expression, lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest, perfect_nestify): Likewise. * lambda.h (gcc_loopnest_to_lambda_loopnest, lambda_loopnest_to_gcc_loopnest): Adjust prototypes. * profile.c (instrument_values): Adjust. * tree-cfg.c (modified_noreturn_calls): Adjust. (remove_fallthru_edge): Likewise. * tree-dump.c (dequeue_and_dump): Adjust. * tree-flow-inline.h (mark_stmt_modified): Adjust. * tree-flow.h (modified_noreturn_calls): Adjust. (tree_on_heap): Remove. (yay!) (register_new_def): Adjust. * tree-into-ssa.c: Define VEC(int,heap). (block_defs_stack): Adjust. (find_idf, insert_phi_nodes, register_new_def, rewrite_initialize_block, rewrite_finalize_block, register_new_update_single, rewrite_update_init_block, rewrite_update_fini_block, rewrite_blocks, ssa_rewrite_finalize_block, ssa_register_new_def, ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise. * tree-loop-linear.c (linear_transform_loops): Adjust. * tree-ssa-alias.c: Define VEC(fieldoff_t,heap). (push_fields_onto_fieldstack, create_overlap_variables_for): Adjust. * tree-ssa-dom.c (avail_exprs_stack, block_defs_stack, stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack, vrp_variables_stack): Adjust declarations. (tree_ssa_dominator_optimize): Adjust. (dom_opt_initialize_block, remove_local_expressions_from_table, restore_nonzero_vars_to_original_value, restore_vars_to_original_value, restore_currdefs_to_original_value, dom_opt_finalize_block, record_var_is_nonzero, record_cond, record_const_or_copy_1, optimize_stmt, update_rhs_and_lookup_avail_expr, lookup_avail_expr, record_range): Likewise. * tree-ssa-pre.c: Define VEC(basic_block,heap). (compute_antic_aux): Adjust. (inserted_exprs, create_expression_by_pieces, insert_into_preds_of_block, eliminate, mark_operand_necessary, remove_dead_inserted_code, fini_pre): Likewise. * tree-ssa-propagate.c (interesting_ssa_edges): Adjust. (varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist. ssa_prop_init): Likewise. * tree-ssa.c: Define VEC(bitmap,heap). (verify_name_tags): Adjust. * value-prof.c (rtl_divmod_values_to_profile): Adjust. (insn_prefetch_values_to_profile, rtl_find_values_to_profile, tree_divmod_values_to_profile, tree_find_values_to_profile, value_profile_transformations): Likewise. * value-prof.h: Define VEC(histogram_value,heap). * varasm.c: Remove alias_pair pointer typedef, define VEC(alias_pair,gc). (finish_aliases_1, finish_aliases_2, assemble_alias): Adjust. * config/pa/pa.c (typedef extern_symbol): Typedef the structure, not a pointer to it. Create an object vector. (extern_symbols): Turn into an object vector. (pa_hpux_asm_output_external, pa_hpux_file_end): Adjust. * cp/cp-tree.h: Adjust for new VEC API. Define VEC(tree_pair_s,gc). (struct save_scope): Adjust. (struct lang_type_class): Adjust. (unemitted_tinfo_decls): Adjust. * cp/class.c (add_method, resort_type_method_vec, finish_struct_methods, struct find_final_overrider_data, dfs_find_final_overrider_pre, find_final_overrider, get_vcall_index, warn_hidden, walk_subobject_offsets, check_methods, fixup_inline_methods, end_of_class, warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer, add_vcall_offset): Adjust. * cp/decl.c (xref_basetypes, finish_method): Adjust. * cp/decl2.c (check_classfn): Adjust. * cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust. * cp/method.c (do_build_copy_constructor): Adjust. * cp/name-lookup.c (new_class_binding, store_binding, store_bindings, store_class_bindings): Adjust. * cp/name-lookup.h: Define VEC(cxx_saved_binding,gc), VEC(cp_class_binding,gc). (struct cp_binding_level): Adjust. * cp/parser.c: Define VEC(cp_token_position,heap). (struct cp_lexer): Adjust. (cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy, cp_lexer_save_tokens): Adjust. * cp/pt.c (retrieve_specialization, check_explicit_specialization): Adjust. * cp/rtti.c (unemitted_tinfo_decls): Adjust. (init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init, get_pseudo_ti_desc): Adjust. * cp/search.c (dfs_access_in_type, lookup_conversion_operator, lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible, dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust. * cp/semantics.c: Define VEC(deferred_access,gc). (push_deferring_access_checks): Adjust. * cp/typeck2.c (abstract_virtuals_error): Adjust. From-SVN: r98498
2005-04-21 11:18:28 +02:00
for (i = 0; VEC_iterate (histogram_value, *values, i, hist); i++)
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
{
switch (hist->type)
{
case HIST_TYPE_INTERVAL:
if (dump_file)
{
fprintf (dump_file, "Interval counter for tree ");
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
print_generic_expr (dump_file, hist->hvalue.stmt,
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
TDF_SLIM);
fprintf (dump_file, ", range %d -- %d.\n",
hist->hdata.intvl.int_start,
(hist->hdata.intvl.int_start
+ hist->hdata.intvl.steps - 1));
}
hist->n_counters = hist->hdata.intvl.steps + 2;
break;
case HIST_TYPE_POW2:
if (dump_file)
{
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
fprintf (dump_file, "Pow2 counter for tree ");
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
print_generic_expr (dump_file, hist->hvalue.stmt, TDF_SLIM);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
fprintf (dump_file, ".\n");
}
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
hist->n_counters = 2;
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
break;
case HIST_TYPE_SINGLE_VALUE:
if (dump_file)
{
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
fprintf (dump_file, "Single value counter for tree ");
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
print_generic_expr (dump_file, hist->hvalue.stmt, TDF_SLIM);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
fprintf (dump_file, ".\n");
}
hist->n_counters = 3;
break;
case HIST_TYPE_CONST_DELTA:
if (dump_file)
{
Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. * Makefile.in (LIBGCOV): Add _gcov_interval_profiler, _gcov_pow2_profiler and _gcov_one_value_profiler. (tree-profile.o): Add GGC_H and gt-tree-profile.h dependency. (GTFILES): Add $(srcdir)/tree-profile.c. * gcov-io.h (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): Declare. * gimplify.c (force_gimple_operand): Check whether the statements should be produced in ssa form. (force_gimple_operand_bsi): New function. * libgcov.c (__gcov_interval_profiler, __gcov_pow2_profiler, __gcov_one_value_profiler): New functions. * rtl-profile.c (rtl_gen_pow2_profiler): Only measure whether the profiled value is a power of two or not. * tree-cfg.c (tree_block_ends_with_condjump_p): Handle empty blocks. * tree-flow.h (in_ssa_p): Declare. (force_gimple_operand_bsi): Declare. * tree-into-ssa.c (in_ssa_p): New variable. (rewrite_into_ssa): Set in_ssa_p. * tree-outof-ssa.c (rewrite_out_of_ssa): Set in_ssa_p. * tree-profile.c: Include ggc.h and gt-tree-profile.h. (gcov_type_node, tree_interval_profiler_fn, tree_pow2_profiler_fn, tree_one_value_profiler_fn): New variables. (tree_init_edge_profiler): Initialize the profiler function decls. (tree_gen_edge_profiler): Use global gcov_type_node. (prepare_instrumented_value): New function. (tree_gen_interval_profiler, tree_gen_interval_profiler, tree_gen_one_value_profiler): Call the library functions instead of creating instrumentation code. * tree.c (build_fn_decl): New function. * tree.h (build_fn_decl): Declare. * value-prof.c (rtl_divmod_values_to_profile, rtl_find_values_to_profile, rtl_mod_pow2_value_transform, tree_mod_pow2_value_transform, tree_find_values_to_profile): Do not handle may_be_other and precise values of exponents at pow2 profiler. (tree_mod_subtract_transform): Reflect that value field of histogram has changed meaning. (tree_divmod_values_to_profile): Record the values correctly. (tree_values_to_profile): Update comment. * value-prof.h (struct histogram_value_t): Remove pow2 data. From-SVN: r98555
2005-04-22 12:57:04 +02:00
fprintf (dump_file, "Constant delta counter for tree ");
Makefile.in (rtl-profile.o): Kill all traces of it. * Makefile.in (rtl-profile.o): Kill all traces of it. * common.opt (fspeculative-prefetching, ftree-based-profiling): Kill. * coverage.h (rtl_coverage_counter_ref): Kill. * opts.c (flag_speculative_prefetching_set): Kill. (flag_loop_optimize_set): New. (common_handle_option): Disable loop optimizer when profiling; do not handle speculative prefetching. * passes.c (init_optimization_passes): Replace pass_profiling combo by branch_prob pass. * profile.c (compute_value_histograms): Update for simplified value profiles. (rtl_register_profile_hooks): Kill. (pass_profiling): Kill. (rest_of_handle_branch_prob): Do not profile. * toplev.c (process_options): Remove speculative prefetching. * toplev.h (flag_tree_based_profiling): Kill. * tree-profile.c (prepare_instrumented_value, tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, do_tree_profiling): Update for simplified datastructures. * value-prof.c: Add comment that speculative prefetching was dropped; update rest of file for simplified datastructures. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX, rtl_divmod_values_to_profile, insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, rtl_values_to_profile, rtl_divmod_fixed_value, rtl_mod_pow2, rtl_mod_subtract, gen_speculative_prefetch, rtl_divmod_fixed_value_transform, rtl_mod_pow2_value_transform, rtl_mod_subtract_transform, speculative_prefetching_transform): Kill. (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): Kill. * value-prof.h (histogram_value_t): Remove IL based unions. (rtl_register_value_prof_hooks, rtl_register_profile_hooks, rtl_profile_hooks): Remove hooks. * invoke.texi (-ftree-based-profiling, -fspeculative-prefetching): Kill. * inliner-1.c: Do not dump everything. * tree-prof.exp: Do not pass -ftree-based-profiling. * bprob.exp: Likewise. From-SVN: r102522
2005-07-28 23:48:38 +02:00
print_generic_expr (dump_file, hist->hvalue.stmt, TDF_SLIM);
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
fprintf (dump_file, ".\n");
}
hist->n_counters = 4;
break;
default:
alias.c (true_dependence): Remove 'abort' from comments. * alias.c (true_dependence): Remove 'abort' from comments. Use gcc_assert and gcc_unreachable as appropriate. (canon_true_dependence): Likewise. * bb-reorder.c (connect_traces): Likewise. * c-common.c (c_add_case_label): Likewise. * c-decl.c (finish_function): Likewise. * caller-save.c (insert_restore, insert_save): Likewise. * cfg.c (update_bb_profile_for_threading): Likewise. * cfganal.c (flow_active_insn_p): Likewise. * cfgexpand.c (add_reg_br_prob_note): Likewise. * cfgrtl.c (rtl_redirect_edge_and_branch_force, rtl_split_edge, cfg_layout_merge_blocks): Likewise. * ifcvt.c (cond_exec_process_insns, merge_if_block, find_if_block): Likewise. * integrate.c (allocate_initial_values): Likewise. * jump.c (reverse_condition, reverse_condition_maybe_unordered, swap_condition, unsigned_condition, signed_condition, mark_jump_label, invert_jump_1, rtx_renumbered_equal_p, reg_or_subregno): Likewise. * lambda-code.c (lambda_compute_auxillary_space, lambda_transform_legal_p): Likewise. * lambda-mat.c (lambda_matrix_inverse_hard): Likewise. * langhooks.c (lhd_set_decl_assembler_name, lhd_type_promotes_to, lhd_incomplete_type_error, lhd_expand_expr, lhd_types_compatible_p, lhd_tree_size): Likewise. * lcm.c (create_pre_exit, optimize_mode_switching): Likewise. * local-alloc.c (update_equiv_regs): Likewise. * loop-unroll.c (peel_loop_completely unroll_loop_constant_iterations, unroll_loop_runtime_iterations, peel_loop_simple, unroll_loop_stupid, analyze_iv_to_split_insn): Likewise. * loop.c (gen_prefetch, find_and_verify_loops, basic_induction_var): Likewise. * modulo-sched.c (normalize_sched_times, check_nodes_order): Likewise. * value-prof.c (tree_find_values_to_profile): Likewise. * varasm.c (named_section, default_assemble_integer, decode_addr_const): Likewise. From-SVN: r98508
2005-04-21 17:47:33 +02:00
gcc_unreachable ();
Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * Makefile.in (value-prof.o): New dependencies on $(DIAGNOSTIC_H) $(TREE_H) and $(COVERAGE_H). * coverage.c (compute_checksum): Use DECL_NAME not DECL_ASSEMBLER_NAME. * opts.c (common_handle_option): Enable tree-based value transforms. * toplev.c (process_options): Ditto. * value-prof.h (struct histogram_value_t): Redefine. "Adjust" below refers to references to this type. * tree-flow.h: (struct stmt_ann_d): Add histograms field. * rtl-profile.c (rtl_gen_interval_profiler): Adjust. Remove checks for may_be_more, may_be_less. (rtl_gen_pow2_profiler): Adjust. (rtl_gen_one_value_profiler_no_edge_manip): Adjust. (rtl_gen_one_value_profiler): Adjust. (rtl_gen_const_delta_profiler): Adjust. * tree-profile.c (tree_gen_interval_profiler): Implement. (tree_gen_pow2_profiler): Ditto. (tree_gen_one_value_profiler): Ditto. (tree_profiling): New. (pass_tree_profile): Reference it. * value-prof.c: Include tree-flow.h, tree-flow-inline.h, diagnostic.h, tree.h, gcov-io.h. (insn_divmod_values_to_profile): Rename to rtl_divmod_values_to_profile. Adjust. (insn_values_to_profile): Rename to rtl_values_to_profile. Adjust. (insn_prefetch_values_to_profile): Adjust. (rtl_value_profile_transformations): Adjust. (gen_divmod_fixed_value): Rename to rtl_divmod_fixed_value. (gen_mod_pow2): Rename to rtl_mod_pow2. (gen_mod_subtract): Rename to rtl_mod_subtract. (divmod_fixed_value_transform): Rename to rtl_divmod_fixed_value_transform. (mod_pow2_value_transform): Rename to rtl_mod_pow2_value_transform. (mod_subtract_transform): Rename to rtl_mod_subtract_transform. (rtl_find_values_to_profile): Adjust. (tree_value_profile_transformations): Implement. (tree_divmod_values_to_profile): New. (tree_values_to_profile): New. (tree_divmod_fixed_value): New. (tree_mod_pow2): New. (tree_mod_subtract): New. (tree_divmod_fixed_value_transform): New. (tree_mod_pow2_value_transform): New. (tree_mod_subtract_transform): New. (tree_find_values_to_profile): Implement. * profile.c (instrument_values): Free histograms. (compute_value_histograms): Adjust. Implement tree version. From-SVN: r97156
2005-03-29 13:45:51 +02:00
}
}
}
static struct value_prof_hooks tree_value_prof_hooks = {
tree_find_values_to_profile,
tree_value_profile_transformations
};
void
tree_register_value_prof_hooks (void)
{
gcc_assert (current_ir_type () == IR_GIMPLE);
value_prof_hooks = &tree_value_prof_hooks;
}
/* IR-independent entry points. */
void
Makefile.in (rtl-profile.o, [...]): Add GCC_H dependency. * Makefile.in (rtl-profile.o, value-prof.o): Add GCC_H dependency. * common.opt (fspeculative-prefetching): New. * flags.h (flag_speculative_prefetching_set): Declare. * gcov-io.c (gcov_write_counter, gcov_read_counter): Allow negative values. * opts.c (flag_sepculative_prefetching_set): New variable. (common_handle_option): Handle -fspeculative-prefetching. * passes.c (rest_of_compilation): Ditto. * profile.c (instrument_values, compute_value_histograms, branch_prob): Use vectors instead of arrays. * toplev.c (process_options): Handle -fspeculative-prefetching. * rtl-profile.c: Include ggc.h. (rtl_gen_interval_profiler, rtl_gen_pow2_profiler, rtl_gen_one_value_profiler_no_edge_manipulation, rtl_gen_one_value_profiler, rtl_gen_const_delta_profiler): Type of argument changed. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Type of argument changed. * value-prof.c: Include ggc.h. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX): New macros. (insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, gen_speculative_prefetch, speculative_prefetching_transform): New. (value_profile_transformations): Call speculative_prefetching_transform. (insn_values_to_profile): Call insn_prefetch_values_to_profile. (insn_divmod_values_to_profile, rtl_find_values_to_profile, tree_find_values_to_profile, find_values to profile): Use vectors instead of arrays. (free_profiled_values): Removed. * value-prof.h (struct histogram_value): Renamed to struct histogram_value_t. (histogram_value, histogram_values): New types. (find_values_to_profile): Declaration changed. (free_profiled_values): Removed. (struct profile_hooks): Type of argument of the hooks changed to histogram_value. * doc/invoke.texi (-fspeculative-prefetching): Document. From-SVN: r86930
2004-09-01 22:58:55 +02:00
find_values_to_profile (histogram_values *values)
{
Makefile.in (rtl-profile.o, [...]): Add GCC_H dependency. * Makefile.in (rtl-profile.o, value-prof.o): Add GCC_H dependency. * common.opt (fspeculative-prefetching): New. * flags.h (flag_speculative_prefetching_set): Declare. * gcov-io.c (gcov_write_counter, gcov_read_counter): Allow negative values. * opts.c (flag_sepculative_prefetching_set): New variable. (common_handle_option): Handle -fspeculative-prefetching. * passes.c (rest_of_compilation): Ditto. * profile.c (instrument_values, compute_value_histograms, branch_prob): Use vectors instead of arrays. * toplev.c (process_options): Handle -fspeculative-prefetching. * rtl-profile.c: Include ggc.h. (rtl_gen_interval_profiler, rtl_gen_pow2_profiler, rtl_gen_one_value_profiler_no_edge_manipulation, rtl_gen_one_value_profiler, rtl_gen_const_delta_profiler): Type of argument changed. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Type of argument changed. * value-prof.c: Include ggc.h. (NOPREFETCH_RANGE_MIN, NOPREFETCH_RANGE_MAX): New macros. (insn_prefetch_values_to_profile, find_mem_reference_1, find_mem_reference_2, find_mem_reference, gen_speculative_prefetch, speculative_prefetching_transform): New. (value_profile_transformations): Call speculative_prefetching_transform. (insn_values_to_profile): Call insn_prefetch_values_to_profile. (insn_divmod_values_to_profile, rtl_find_values_to_profile, tree_find_values_to_profile, find_values to profile): Use vectors instead of arrays. (free_profiled_values): Removed. * value-prof.h (struct histogram_value): Renamed to struct histogram_value_t. (histogram_value, histogram_values): New types. (find_values_to_profile): Declaration changed. (free_profiled_values): Removed. (struct profile_hooks): Type of argument of the hooks changed to histogram_value. * doc/invoke.texi (-fspeculative-prefetching): Document. From-SVN: r86930
2004-09-01 22:58:55 +02:00
(value_prof_hooks->find_values_to_profile) (values);
}
bool
value_profile_transformations (void)
{
return (value_prof_hooks->value_profile_transformations) ();
}
Makefile.in: Adjust dependencies. 2005-07-05 Paolo Bonzini <bonzini@gnu.org> * Makefile.in: Adjust dependencies. * tree-pass.h: Add new passes and passes formerly in tree-optimize.c. * basic-block.h (duplicate_computed_gotos): Remove, it is now static. * alias.c (rest_of_handle_cfg, pass_cfg): New. * bb-reorder.c (duplicate_computed_gotos): Make it static. * cfgexpand.c (tree_expand_cfg): Add code formerly at the beginning of rest_of_compilation. * bb-reorder.c (gate_duplicate_computed_gotos, pass_duplicate_computed_gotos, gate_handle_reorder_blocks, rest_of_handle_reorder_blocks, pass_reorder_blocks, gate_handle_partition_blocks, rest_of_handle_partition_blocks, pass_partition_blocks): New. * bt-load.c (gate_handle_branch_target_load_optimize, rest_of_handle_branch_target_load_optimize, pass_branch_target_load_optimize): New. * cfgcleanup.c (rest_of_handle_jump, pass_jump, rest_of_handle_jump2, pass_jump2): New. * cfglayout.c (pass_insn_locators_initialize): New. * cfgrtl.c (pass_free_cfg): New. * combine.c (gate_handle_combine, rest_of_handle_combine, pass_combine): New. * cse.c (gate_handle_cse, rest_of_handle_cse, pass_cse, gate_handle_cse2, rest_of_handle_cse2, pass_cse2): New. * emit-rtl.c (pass_unshare_all_rtl, pass_remove_unnecessary_notes): New. * except.c (pass_set_nothrow_function_flags, pass_convert_to_eh_region_ranges, gate_handle_eh, rest_of_handle_eh, pass_rtl_eh): New. * final.c (pass_compute_alignments, rest_of_handle_final, pass_final, rest_of_handle_shorten_branches, pass_shorten_branches, rest_of_clean_state, pass_clean_state): New. * flow.c (pass_recompute_reg_usage, gate_remove_death_notes, rest_of_handle_remove_death_notes, pass_remove_death_notes, rest_of_handle_life, pass_life, rest_of_handle_flow2, pass_flow2): New. * function.c (pass_instantiate_virtual_regs, pass_init_function, rest_of_handle_check_leaf_regs, pass_leaf_regs): New. * gcse.c (gate_handle_jump_bypass, rest_of_handle_jump_bypass, pass_jump_bypass, gate_handle_gcse, rest_of_handle_gcse, pass_gcse): New. * global.c (rest_of_handle_global_alloc, pass_global_alloc): New. * ifcvt.c (gate_handle_if_conversion, rest_of_handle_if_conversion, pass_rtl_ifcvt, gate_handle_if_after_combine, rest_of_handle_if_after_combine, pass_if_after_combine, gate_handle_if_after_reload, rest_of_handle_if_after_reload, pass_if_after_reload): New. * integrate.c (pass_initial_value_sets): New. * jump.c (pass_cleanup_barriers, purge_line_number_notes, pass_purge_lineno_notes): New. * mode-switching.c (rest_of_handle_mode_switching, pass_mode_switching): New. * local-alloc.c (rest_of_handle_local_alloc, pass_local_alloc): New. * loop-init.c (gate_handle_loop2, rest_of_handle_loop2, pass_loop2): New. * loop.c (gate_handle_loop_optimize, rest_of_handle_loop_optimize, pass_loop_optimize): New. * modulo-sched.c (gate_handle_sms, rest_of_handle_sms, pass_sms): New. * postreload-gcse.c (gate_handle_gcse2, rest_of_handle_gcse2, pass_gcse2): New. * postreload.c (gate_handle_postreload, rest_of_handle_postreload, pass_postreload_cse): New. * profile.c (gate_handle_profiling, pass_profiling, rest_of_handle_branch_prob, pass_branch_prob): New. * recog.c (pass pass_split_for_shorten_branches, gate_do_final_split, pass_split_before_regstack, gate_handle_split_before_regstack, gate_handle_peephole2, rest_of_handle_peephole2, pass_peephole2, rest_of_handle_split_all_insns, pass_split_all_insns): New. * reg-stack.c (gate_handle_stack_regs, rest_of_handle_stack_regs, pass_stack_regs): New. * regmove.c (gate_handle_regmove, rest_of_handle_regmove, pass_regmove, gate_handle_stack_adjustments, rest_of_handle_stack_adjustments, pass_stack_adjustments): New. * regrename.c (gate_handle_regrename, rest_of_handle_regrename, pass_regrename): New. * reorg.c (gate_handle_delay_slots, rest_of_handle_delay_slots, pass_delay_slots, gate_handle_machine_reorg, rest_of_handle_machine_reorg, pass_machine_reorg): New. * rtl.h (extern void purge_line_number_notes): New. * sched-rgn.c (gate_handle_sched, rest_of_handle_sched, gate_handle_sched2, rest_of_handle_sched2, pass_sched, pass_sched2): New. * tracer.c (gate_handle_tracer, rest_of_handle_tracer, pass_tracer): New. * value-prof.c (gate_handle_value_profile_transformations, rest_of_handle_value_profile_transformations, pass_value_profile_transformations): New. * var-tracking.c (gate_handle_var_tracking, pass_variable_tracking): New. * web.c (gate_handle_web, rest_of_handle_web, pass_web): New. * passes.c (open_dump_file, close_dump_file, rest_of_handle_final, rest_of_handle_delay_slots, rest_of_handle_stack_regs, rest_of_handle_variable_tracking, rest_of_handle_machine_reorg, rest_of_handle_old_regalloc, rest_of_handle_regrename, rest_of_handle_reorder_blocks, rest_of_handle_partition_blocks, rest_of_handle_sms, rest_of_handle_sched, rest_of_handle_sched2, rest_of_handle_gcse2, rest_of_handle_regmove, rest_of_handle_tracer, rest_of_handle_if_conversion, rest_of_handle_if_after_combine, rest_of_handle_if_after_reload, rest_of_handle_web, rest_of_handle_branch_prob, rest_of_handle_value_profile_transformations, rest_of_handle_cfg, rest_of_handle_jump_bypass, rest_of_handle_combine, rest_of_handle_life, rest_of_handle_cse, rest_of_handle_cse2, rest_of_handle_gcse, rest_of_handle_loop_optimize, rest_of_handle_loop2, rest_of_handle_branch_target_load_optimize, rest_of_handle_mode_switching, rest_of_handle_jump, rest_of_handle_eh, rest_of_handle_stack_adjustments, rest_of_handle_flow2, rest_of_handle_jump2, rest_of_handle_peephole2, rest_of_handle_postreload, rest_of_handle_shorten_branches, rest_of_clean_state, rest_of_compilation): Remove. * cgraphunit.c (ipa_passes): Moved from tree-optimize.c. * passes.c (dump_flags, in_gimple_form, all_passes, all_ipa_passes, all_lowering_passes, register_one_dump_file, register_dump_files, next_pass_1, last_verified, execute_todo, execute_one_pass, execute_pass_list, execute_ipa_pass_list): Moved from tree-optimize.c. (init_optimization_passes): Moved from tree-optimize.c, adding the RTL optimizations. * tree-dump.h (dump_info_p, dump_flag): Moved from tree.h. * tree-optimize.c (dump_flags, in_gimple_form, all_passes, all_ipa_passes, all_lowering_passes, register_one_dump_file, register_dump_files, next_pass_1, last_verified, execute_todo, execute_one_pass, execute_pass_list, execute_ipa_pass_list, init_tree_optimization_passes, ipa_passes): Delete. * tree-pass.h (enum tree_dump_index): Moved from tree.h, removing the RTL dumps. (TDF_*, get_dump_file_name, dump_enabled_p, dump_initialized_p, dump_begin, dump_end, dump_node, dump_switch_p, dump_flag_name): Moved from tree.h. (ipa_passes): Remove. (all_passes, all_ipa_passes, all_lowering_passes): Now extern. * tree.h (enum tree_dump_index, TDF_*, get_dump_file_name, dump_enabled_p, dump_initialized_p, dump_begin, dump_end, dump_node, dump_switch_p, dump_flag_name): Moved to tree-pass.h. (dump_info_p, dump_flag): Moved to tree-dump.h. * Makefile.in: Adjust dependencies for tree-pretty-print.c, cgraph.c, opts.c. * passes.c (finish_optimization_passes): Use dump_begin and dump_end, TDI_end. (gate_rest_of_compilation): New. (pass_rest_of_compilation): Use it. (gate_postreload, pass_postreload): New. * toplev.c (general_init): Rename init_tree_optimization_passes. * toplev.h (init_tree_optimization_passes): Rename to init_optimizations_passes. * tree-dump.c (dump_flag): Make static. (dump_files): Remove RTL dumps. * tree-optimize.c (pass_all_optimizations, pass_early_local_passes, pass_cleanup_cfg, pass_free_cfg_annotations, pass_cleanup_cfg_post_optimizing, pass_free_datastructures, pass_init_datastructures, pass_fixup_cfg): Make non-static. * tree-pretty-print.c: Include tree-pass.h. * cgraph.c: Include tree-dump.h. cp: 2005-07-05 Paolo Bonzini <bonzini@gnu.org> * Makefile.in (class.o, decl2.o): Adjust dependencies. * class.c: Include tree-dump.h. * decl2.c: Include tree-dump.h. java: 2005-07-05 Paolo Bonzini <bonzini@gnu.org> * Makefile.in (parse.o): Adjust dependencies. * parse.y: Include tree-dump.h. From-SVN: r101627
2005-07-05 18:20:53 +02:00