GCC Middle and Back End API Reference
|
Data Structures | |
struct | bb_info |
struct | split_point |
struct | stack_entry |
Functions | |
static tree | find_retval (basic_block return_bb) |
static bool | test_nonssa_use () |
static void | dump_split_point () |
static bool | verify_non_ssa_vars (struct split_point *current, bitmap non_ssa_vars, basic_block return_bb) |
static void | check_forbidden_calls () |
static bool | dominated_by_forbidden () |
static void | consider_split (struct split_point *current, bitmap non_ssa_vars, basic_block return_bb) |
static basic_block | find_return_bb () |
static tree | find_retval () |
static bool | mark_nonssa_use () |
static bool | visit_bb (basic_block bb, basic_block return_bb, bitmap set_ssa_names, bitmap used_ssa_names, bitmap non_ssa_vars) |
static void | find_split_points () |
static void | split_function () |
static unsigned int | execute_split_functions () |
static bool | gate_split_functions () |
gimple_opt_pass * | make_pass_split_functions () |
static bool | gate_feedback_split_functions () |
static unsigned int | execute_feedback_split_functions () |
gimple_opt_pass * | make_pass_feedback_split_functions () |
Variables | |
static vec< bb_info > | bb_info_vec |
struct split_point | best_split_point |
static bitmap | forbidden_dominators |
|
static |
If STMT is a call, check the callee against a list of forbidden predicate functions. If a match is found, look for uses of the call result in condition statements that compare against zero. For each such use, find the block targeted by the condition statement for the nonzero result, and set the bit for this block in the forbidden dominators bitmap. The purpose of this is to avoid selecting a split point where we are likely to lose the chance to optimize away an unused function call.
References bitmap_set_bit(), edge_def::dest, extract_true_false_edges_from_block(), gimple_bb(), gimple_call_builtin_p(), gimple_call_lhs(), gimple_cond_code(), gimple_cond_rhs(), basic_block_def::index, and integer_zerop().
Referenced by execute_split_functions().
|
static |
We found an split_point CURRENT. NON_SSA_VARS is bitmap of all non ssa variables used and RETURN_BB is return basic block. See if we can split function here.
References best_split_point, bitmap_bit_p(), bitmap_copy(), bitmap_count_bits(), bitmap_empty_p(), eni_weights_d::call_cost, cfun, current_function_decl, dominated_by_forbidden(), dump_file, dump_flags, dump_split_point(), eni_size_weights, split_point::entry_bb, estimate_move_cost(), find_retval(), edge_def::flags, frequency, basic_block_def::frequency, gimple_bb(), gimple_phi_arg_def(), gimple_phi_arg_edge(), gimple_phi_num_args(), gimple_phi_result(), gsi_end_p(), gsi_next(), gsi_start_phis(), gsi_stmt(), split_point::header_size, basic_block_def::index, is_gimple_min_invariant(), is_gimple_reg(), basic_block_def::preds, PROFILE_READ, split_point::split_bbs, split_point::split_part_set_retval, split_point::split_size, edge_def::src, ssa_default_def(), split_point::ssa_names_to_pass, verify_non_ssa_vars(), and virtual_operand_p().
Referenced by find_split_points().
|
static |
If BB is dominated by any block in the forbidden dominators set, return TRUE; else FALSE.
References CDI_DOMINATORS, and dominated_by_p().
Referenced by consider_split().
|
static |
Dump split point CURRENT.
References dump_bitmap(), split_point::entry_bb, split_point::header_size, split_point::header_time, basic_block_def::index, split_point::split_bbs, split_point::split_size, split_point::split_time, and split_point::ssa_names_to_pass.
Referenced by consider_split(), and split_function().
|
static |
Execute function splitting pass.
References execute_split_functions().
|
static |
Execute function splitting pass.
References symtab_node_base::address_taken, best_split_point, calculate_dominance_info(), cgraph_node::callers, CDI_DOMINATORS, cgraph_get_node(), check_forbidden_calls(), compute_call_stmt_bb_frequency(), current_function_decl, symtab_node_base::decl, dump_file, dump_flags, eni_size_weights, eni_time_weights, estimate_num_insns(), symtab_node_base::externally_visible, find_split_points(), flags_from_decl_or_type(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_stmt(), basic_block_def::index, inline_summary::inlinable, inline_edge_summary_vec, inline_summary(), mark_dfs_back_edges(), memset(), cgraph_edge::next_caller, overall_size, print_gimple_stmt(), PROFILE_READ, split_point::split_bbs, split_function(), split_point::ssa_names_to_pass, cgraph_node::symbol, and tree_versionable_function_p().
Referenced by execute_feedback_split_functions().
|
static |
Return basic block containing RETURN statement. We allow basic blocks of the form: <retval> = tmp_var; return <retval> but return_bb can not be more complex than this. If nothing is found, return EXIT_BLOCK_PTR. When there are multiple RETURN statement, chose one with return value, since that one is more likely shared by multiple code paths. Return BB is special, because for function splitting it is the only basic block that is duplicated in between header and split part of the function. TODO: We might support multiple return blocks.
References auto_var_in_fn_p(), current_function_decl, gimple_assign_lhs(), gimple_assign_rhs1(), gimple_assign_single_p(), gimple_clobber_p(), gimple_return_retval(), gsi_end_p(), gsi_last_bb(), gsi_prev(), gsi_stmt(), is_gimple_debug(), is_gimple_min_invariant(), single_pred_edge(), single_pred_p(), and edge_def::src.
Referenced by find_split_points(), and split_function().
|
static |
Referenced by consider_split(), and split_function().
|
static |
Given return basic block RETURN_BB, see where return value is really stored.
References gimple_assign_rhs1(), gimple_clobber_p(), gimple_return_retval(), gsi_end_p(), gsi_next(), gsi_start_bb(), and gsi_stmt().
|
static |
Find all articulations and call consider_split on them. OVERALL_TIME and OVERALL_SIZE is time and size of the function. We perform basic algorithm for finding an articulation in a graph created from CFG by considering it to be an unoriented graph. The articulation is discovered via DFS walk. We collect earliest basic block on stack that is reachable via backward edge. Articulation is any basic block such that there is no backward edge bypassing it. To reduce stack usage we maintain heap allocated stack in STACK vector. AUX pointer of BB is set to index it appears in the stack or -1 once it is visited and popped off the stack. The algorithm finds articulation after visiting the whole component reachable by it. This makes it convenient to collect information about the component used by consider_split.
References basic_block_def::aux, stack_entry::bb, stack_entry::bbs_visited, bitmap_and_compl(), bitmap_ior_into(), bitmap_set_bit(), stack_entry::can_split, consider_split(), edge_def::dest, dump_file, dump_flags, stack_entry::earliest, stack_entry::edge_num, split_point::entry_bb, find_return_bb(), first, split_point::header_size, split_point::header_time, basic_block_def::index, stack_entry::non_ssa_vars, overall_size, stack_entry::overall_size, stack_entry::overall_time, basic_block_def::preds, stack_entry::set_ssa_names, split_point::split_bbs, split_point::split_size, split_point::split_time, edge_def::src, split_point::ssa_names_to_pass, stack, basic_block_def::succs, stack_entry::used_ssa_names, visit_bb(), and vNULL.
Referenced by execute_split_functions().
|
static |
Gate feedback driven function splitting pass. We don't need to split when profiling at all, we are producing lousy code anyway.
|
static |
Gate function splitting pass. When doing profile feedback, we want to execute the pass after profiling is read. So disable one in early optimization.
gimple_opt_pass* make_pass_feedback_split_functions | ( | ) |
gimple_opt_pass* make_pass_split_functions | ( | ) |
|
static |
Callback for walk_stmt_load_store_addr_ops. If T is non-SSA automatic variable, mark it as used in bitmap passed via DATA. Return true when access to T prevents splitting the function.
References auto_var_in_fn_p(), bitmap_bit_p(), bitmap_set_bit(), current_function_decl, dump_file, dump_flags, get_base_address(), and is_gimple_reg().
Referenced by visit_bb().
|
static |
Split function at SPLIT_POINT.
References add_bb_to_loop(), add_phi_arg(), aggregate_value_p(), bitmap_bit_p(), bitmap_set_bit(), cgraph_local_info::can_change_signature, CDI_DOMINATORS, CDI_POST_DOMINATORS, cfun, cgraph_function_versioning(), cgraph_get_node(), cgraph_node_remove_callees(), compute_inline_parameters(), copy_ssa_name(), edge_def::count, basic_block_def::count, create_basic_block(), create_tmp_reg(), current_function_decl, symtab_node_base::decl, decl_debug_args_insert(), dump_file, dump_flags, dump_function_to_file(), dump_split_point(), split_point::entry_bb, find_return_bb(), find_retval(), force_gimple_operand_gsi(), free_dominance_info(), basic_block_def::frequency, get_or_create_ssa_default_def(), gimple_assign_set_rhs1(), gimple_build_assign_with_ops(), gimple_build_call_vec(), gimple_build_return(), gimple_call_set_lhs(), gimple_call_set_return_slot_opt(), gimple_clobber_p(), gimple_phi_result(), gimple_return_set_retval(), gimple_set_block(), gimple_set_vuse(), gimple_vdef(), gimple_vuse(), gsi_after_labels(), GSI_CONTINUE_LINKING, gsi_end_p(), gsi_insert_after(), gsi_insert_before(), gsi_last_bb(), GSI_NEW_STMT, gsi_next(), GSI_SAME_STMT, gsi_start_bb(), gsi_start_phis(), gsi_stmt(), basic_block_def::index, ipa_remove_all_references(), is_gimple_reg(), is_gimple_reg_type(), is_gimple_val(), last_stmt(), cgraph_node::local, make_edge(), make_ssa_name(), mark_virtual_phi_result_for_renaming(), NOT_BUILT_IN, pop_cfun(), basic_block_def::preds, edge_def::probability, push_cfun(), rebuild_cgraph_edges(), redirect_edge_and_branch(), symtab_node_base::ref_list, remove_edge(), remove_phi_node(), single_succ(), split_point::split_bbs, split_block(), split_point::split_part_set_retval, edge_def::src, ssa_default_def(), split_point::ssa_names_to_pass, cgraph_node::symbol, unshare_expr(), update_stmt(), useless_type_conversion_p(), vec_safe_length(), vec_safe_push(), virtual_operand_p(), and vNULL.
Referenced by execute_split_functions().
|
static |
Callback for walk_stmt_load_store_addr_ops. If T is non-SSA automatic variable, check it if it is present in bitmap passed via DATA.
References auto_var_in_fn_p(), bitmap_bit_p(), current_function_decl, get_base_address(), and is_gimple_reg().
Referenced by verify_non_ssa_vars().
|
static |
Look for all BBs in header that might lead to the split part and verify that they are not defining any non-SSA var used by the split part. Parameters are the same as for consider_split.
References bitmap_bit_p(), bitmap_set_bit(), edge_def::dest, edge_def::dest_idx, split_point::entry_bb, gimple_label_label(), gimple_phi_arg_def(), gimple_phi_result(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), basic_block_def::index, is_gimple_debug(), basic_block_def::preds, split_point::split_bbs, edge_def::src, basic_block_def::succs, test_nonssa_use(), virtual_operand_p(), vNULL, walk_stmt_load_store_addr_ops(), and worklist.
Referenced by consider_split().
|
static |
Compute local properties of basic block BB we collect when looking for split points. We look for ssa defs and store them in SET_SSA_NAMES, for ssa uses and store them in USED_SSA_NAMES and for any non-SSA automatic vars stored in NON_SSA_VARS. When BB has edge to RETURN_BB, collect uses in RETURN_BB too. Return false when BB contains something that prevents it from being put into split function.
References bitmap_set_bit(), BUILT_IN_NORMAL, edge_def::dest, edge_def::dest_idx, dump_file, dump_flags, gimple_call_fndecl(), gimple_clobber_p(), gimple_phi_arg_def(), gimple_phi_num_args(), gimple_phi_result(), gsi_end_p(), gsi_next(), gsi_start_bb(), gsi_start_phis(), gsi_stmt(), is_gimple_debug(), mark_nonssa_use(), basic_block_def::succs, virtual_operand_p(), and walk_stmt_load_store_addr_ops().
Referenced by find_split_points().
struct split_point best_split_point |
Best split point found.
Referenced by consider_split(), and execute_split_functions().
|
static |
Set of basic blocks that are not allowed to dominate a split point.