GCC Middle and Back End API Reference
|
Data Structures | |
struct | bb_info |
Functions | |
static void | find_spanning_tree (struct edge_list *) |
static unsigned | instrument_edges () |
static void | instrument_values () |
void | get_working_sets () |
gcov_working_set_t * | find_working_set () |
static gcov_type * | get_exec_counts () |
static bool | is_edge_inconsistent () |
static void | correct_negative_edge_counts () |
static bool | is_inconsistent () |
static void | set_bb_counts () |
static int | read_profile_edge_counts () |
static int | compute_frequency_overlap () |
static void | compute_branch_probabilities () |
static void | compute_value_histograms (histogram_values values, unsigned cfg_checksum, unsigned lineno_checksum) |
static void | output_location (char const *file_name, int line, gcov_position_t *offset, basic_block bb) |
void | branch_prob () |
static basic_block | find_group () |
static void | union_groups () |
static void | find_spanning_tree () |
void | init_branch_prob () |
void | end_branch_prob () |
Variables | |
struct gcov_ctr_summary * | profile_info |
static gcov_working_set_t | gcov_working_sets [NUM_GCOV_WORKING_SETS] |
static int | total_num_blocks |
static int | total_num_edges |
static int | total_num_edges_ignored |
static int | total_num_edges_instrumented |
static int | total_num_blocks_created |
static int | total_num_passes |
static int | total_num_times_called |
static int | total_hist_br_prob [20] |
static int | total_num_branches |
void branch_prob | ( | void | ) |
Instrument and/or analyze program behavior based on program the CFG. This function creates a representation of the control flow graph (of the function being compiled) that is suitable for the instrumentation of edges and/or converting measured edge counts to counts on the complete CFG. When FLAG_PROFILE_ARCS is nonzero, this function instruments the edges in the flow graph that are needed to reconstruct the dynamic behavior of the flow graph. This data is written to the gcno file for gcov. When FLAG_BRANCH_PROBABILITIES is nonzero, this function reads auxiliary information from the gcda file containing edge count information from previous executions of the function being compiled. In this case, the control flow graph is annotated with actual execution counts by compute_branch_probabilities(). Main entry point of this file.
References add_noreturn_fake_exit_edges(), alloc_aux_for_edges(), BUILT_IN_NORMAL, compact_blocks(), compute_branch_probabilities(), compute_value_histograms(), edge_def::count, coverage_begin_function(), coverage_compute_cfg_checksum(), coverage_compute_lineno_checksum(), coverage_counter_alloc(), coverage_end_function(), create_edge_list(), curr_location, current_function_decl, edge_def::dest, dump_file, expand_location(), find_spanning_tree(), first, edge_def::flags, flow_call_edges_add(), free_aux_for_edges(), free_edge_list(), gcov_write_length(), gcov_write_string(), gcov_write_tag(), gcov_write_unsigned(), gimple_call_flags(), gimple_call_fndecl(), gimple_filename(), gimple_find_values_to_profile(), gimple_has_location(), gimple_init_edge_profiler(), gimple_lineno(), gimple_location(), edge_def::goto_locus, gsi_after_labels(), gsi_commit_edge_inserts(), gsi_end_p(), gsi_last_nondebug_bb(), gsi_next(), gsi_next_nondebug(), gsi_prev_nondebug(), gsi_start_bb(), gsi_stmt(), edge_info::ignore, basic_block_def::index, instrument_edges(), instrument_values(), is_gimple_call(), is_gimple_debug(), last, make_edge(), basic_block_def::next_bb, edge_list::num_edges, offset, edge_info::on_tree, output_location(), basic_block_def::preds, remove_fake_edges(), single_succ_edge(), single_succ_p(), split_block_after_labels(), split_edge(), edge_def::src, basic_block_def::succs, total_num_blocks, total_num_edges, total_num_edges_ignored, total_num_edges_instrumented, and total_num_times_called.
Referenced by tree_profiling().
|
static |
Compute the branch probabilities for the various branches. Annotate them accordingly. CFG_CHECKSUM is the precomputed checksum for the CFG.
References alloc_aux_for_blocks(), block_ends_with_call_p(), block_ends_with_condjump_p(), changes, compute_frequency_overlap(), compute_function_frequency(), correct_negative_edge_counts(), edge_def::count, basic_block_def::count, bb_info::count_valid, counts_to_freqs(), edge_def::dest, dump_file, dump_flags, error(), edge_def::flags, free_aux_for_blocks(), get_exec_counts(), gimple_dump_cfg(), edge_info::ignore, basic_block_def::index, inform(), input_location, is_inconsistent(), mcf_smooth_cfg(), bb_info::pred_count, basic_block_def::preds, prob, edge_def::probability, PROFILE_ABSENT, PROFILE_READ, read_profile_edge_counts(), gcov_ctr_summary::run_max, gcov_ctr_summary::runs, set_bb_counts(), edge_def::src, bb_info::succ_count, basic_block_def::succs, gcov_ctr_summary::sum_all, gcov_ctr_summary::sum_max, total_hist_br_prob, total_num_branches, and total_num_passes.
Referenced by branch_prob().
|
static |
Compare the static estimated profile to the actual profile, and return the "degree of overlap" measure between them. Degree of overlap is a number between 0 and OVERLAP_BASE. It is the sum of each basic block's minimum relative weights between two profiles. And overlap of OVERLAP_BASE means two profiles are identical.
References basic_block_def::count, and basic_block_def::frequency.
Referenced by compute_branch_probabilities().
|
static |
Load value histograms values whose description is stored in VALUES array from .gcda file. CFG_CHECKSUM is the precomputed checksum for the CFG.
References cfun, histogram_value_t::counters, free(), get_coverage_counts(), gimple_add_histogram_value(), histogram_value_t::hvalue, histogram_value_t::n_counters, histogram_value_t::stmt, and histogram_value_t::type.
Referenced by branch_prob().
|
static |
References edge_def::count, and basic_block_def::succs.
Referenced by compute_branch_probabilities().
void end_branch_prob | ( | void | ) |
Performs file-level cleanup after branch-prob processing is completed.
References dump_file, total_hist_br_prob, total_num_blocks, total_num_blocks_created, total_num_branches, total_num_edges, total_num_edges_ignored, total_num_edges_instrumented, total_num_passes, and total_num_times_called.
Referenced by gcc::pass_manager::finish_optimization_passes().
|
static |
Union find algorithm implementation for the basic blocks using aux fields.
References basic_block_def::aux.
Referenced by find_spanning_tree(), and union_groups().
|
static |
Forward declarations.
Referenced by branch_prob().
|
static |
This function searches all of the edges in the program flow graph, and puts as many bad edges as possible onto the spanning tree. Bad edges include abnormals edges, which can't be instrumented at the moment. Since it is possible for fake edges to form a cycle, we will have to develop some better way in the future. Also put critical edges to the tree, since they are more expensive to instrument.
References basic_block_def::aux, clear_aux_for_blocks(), edge_def::dest, dump_file, find_group(), edge_def::flags, edge_info::ignore, basic_block_def::index, edge_def::src, and union_groups().
gcov_working_set_t* find_working_set | ( | ) |
Given a the desired percentage of the full profile (sum_all from the summary), multiplied by 10 to avoid float in PCT_TIMES_10, returns the corresponding working set information. If an exact match for the percentage isn't found, the closest value is used.
|
static |
Computes hybrid profile for all matching entries in da_file. CFG_CHECKSUM is the precomputed checksum for the CFG.
References dump_file, get_coverage_counts(), get_working_sets(), edge_info::ignore, edge_info::on_tree, gcov_ctr_summary::runs, basic_block_def::succs, and gcov_ctr_summary::sum_max.
Referenced by compute_branch_probabilities().
void get_working_sets | ( | void | ) |
Fill the working set information into the profile_info structure.
References compute_working_sets(), dump_file, HOST_WIDEST_INT, HOST_WIDEST_INT_PRINT_DEC, gcov_working_set_info::min_counter, and gcov_working_set_info::num_counters.
Referenced by get_exec_counts(), and input_symtab().
void init_branch_prob | ( | void | ) |
Perform file-level initialization for branch-prob processing.
References total_hist_br_prob, total_num_blocks, total_num_blocks_created, total_num_branches, total_num_edges, total_num_edges_ignored, total_num_edges_instrumented, total_num_passes, and total_num_times_called.
|
static |
Add edge instrumentation code to the entire insn chain. F is the first insn of the chain. NUM_BLOCKS is the number of basic blocks found in F.
References edge_def::dest, dump_file, edge_def::flags, gimple_gen_edge_profiler(), edge_info::ignore, basic_block_def::index, edge_info::on_tree, edge_def::src, basic_block_def::succs, and total_num_blocks_created.
Referenced by branch_prob().
|
static |
Add code to measure histograms for values in list VALUES.
References coverage_counter_alloc(), gimple_gen_average_profiler(), gimple_gen_const_delta_profiler(), gimple_gen_ic_profiler(), gimple_gen_interval_profiler(), gimple_gen_ior_profiler(), gimple_gen_one_value_profiler(), gimple_gen_pow2_profiler(), HIST_TYPE_AVERAGE, HIST_TYPE_CONST_DELTA, HIST_TYPE_INDIR_CALL, HIST_TYPE_INTERVAL, HIST_TYPE_IOR, HIST_TYPE_POW2, HIST_TYPE_SINGLE_VALUE, histogram_value_t::n_counters, and histogram_value_t::type.
Referenced by branch_prob().
|
static |
References block_ends_with_call_p(), edge_def::count, edge_def::dest, dump_bb(), dump_file, edge_def::flags, HOST_WIDEST_INT_PRINT_DEC, edge_info::ignore, basic_block_def::index, and edge_def::src.
Referenced by is_inconsistent().
|
static |
Check consistency. Return true if inconsistency is found.
References block_ends_with_call_p(), basic_block_def::count, dump_bb(), dump_file, find_edge(), HOST_WIDEST_INT_PRINT_DEC, basic_block_def::index, is_edge_inconsistent(), basic_block_def::preds, basic_block_def::succs, and sum_edge_counts().
Referenced by compute_branch_probabilities().
|
static |
When passed NULL as file_name, initialize. When passed something else, output the necessary commands to change line to LINE and offset to FILE_NAME.
References gcov_write_string(), gcov_write_tag(), gcov_write_unsigned(), and basic_block_def::index.
Referenced by branch_prob().
|
static |
Reads profile data and returns total number of edge counts read
References edge_def::count, edge_def::dest, dump_file, error(), HOST_WIDEST_INT, HOST_WIDEST_INT_PRINT_DEC, edge_info::ignore, basic_block_def::index, inform(), input_location, edge_info::on_tree, basic_block_def::succs, and gcov_ctr_summary::sum_max.
Referenced by compute_branch_probabilities().
|
static |
Set each basic block count to the sum of its outgoing edge counts
References basic_block_def::count, basic_block_def::succs, and sum_edge_counts().
Referenced by compute_branch_probabilities().
|
static |
References basic_block_def::aux, and find_group().
Referenced by find_spanning_tree().
|
static |
Counter working set information computed from the current counter summary. Not initialized unless profile_info summary is non-NULL.
Referenced by dump_working_sets().
struct gcov_ctr_summary* profile_info |
Counter summary from the last set of coverage counts read.
Referenced by cgraph_maybe_hot_edge_p(), compute_function_frequency(), eliminate_partially_redundant_load(), find_single_block_region(), inline_small_functions(), maybe_hot_count_p(), maybe_hot_frequency_p(), merge_profile_summaries(), output_profile_summary(), probably_never_executed_bb_p(), report_unroll_peel(), schedule_ebbs(), sms_schedule(), tail_duplicate(), and try_unroll_loop_completely().
|
static |
Referenced by compute_branch_probabilities(), end_branch_prob(), and init_branch_prob().
|
static |
Collect statistics on the performance of this pass for the entire source file.
Referenced by branch_prob(), end_branch_prob(), and init_branch_prob().
|
static |
Referenced by end_branch_prob(), init_branch_prob(), and instrument_edges().
|
static |
Referenced by compute_branch_probabilities(), end_branch_prob(), and init_branch_prob().
|
static |
Referenced by branch_prob(), end_branch_prob(), and init_branch_prob().
|
static |
Referenced by branch_prob(), end_branch_prob(), and init_branch_prob().
|
static |
Referenced by branch_prob(), end_branch_prob(), and init_branch_prob().
|
static |
Referenced by compute_branch_probabilities(), end_branch_prob(), and init_branch_prob().
|
static |
Referenced by branch_prob(), end_branch_prob(), and init_branch_prob().