GCC Middle and Back End API Reference
|
Go to the source code of this file.
Data Structures | |
struct | edge_list |
class | control_dependences |
|
extern |
This function will add a fake edge between any block which has no successors, and the exit block. Some data flow equations require these edges to exist.
References cfun, EDGE_COUNT, EXIT_BLOCK_PTR_FOR_FN, FOR_EACH_BB_FN, make_single_succ_edge(), and basic_block_def::succs.
Referenced by branch_prob(), cleanup_cfg(), connect_infinite_loops_to_exit(), and one_pre_gcse_pass().
|
extern |
Set the bitmap DST to the intersection of SRC of predecessors of basic block B.
References b, bitmap_copy(), bitmap_ones(), cfun, EDGE_COUNT, EDGE_PRED, simple_bitmap_def::elms, ENTRY_BLOCK_PTR_FOR_FN, i, NULL, r, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.
Referenced by compute_available().
|
extern |
Intersection and union of preds/succs for sbitmap based data flow solvers. All four functions defined below take the same arguments: B is the basic block to perform the operation for. DST is the target sbitmap, i.e. the result. SRC is an sbitmap vector of size last_basic_block so that it can be indexed with basic block indices. DST may be (but does not have to be) SRC[B->index].
Set the bitmap DST to the intersection of SRC of successors of basic block B.
References b, bitmap_copy(), bitmap_ones(), cfun, EDGE_COUNT, EDGE_SUCC, simple_bitmap_def::elms, EXIT_BLOCK_PTR_FOR_FN, i, NULL, r, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.
Referenced by compute_antinout_edge(), and compute_code_hoist_vbeinout().
|
extern |
Set the bitmap DST to the union of SRC of predecessors of basic block B.
References b, bitmap_clear(), bitmap_copy(), cfun, EDGE_COUNT, EDGE_PRED, simple_bitmap_def::elms, ENTRY_BLOCK_PTR_FOR_FN, i, r, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.
|
extern |
Set the bitmap DST to the union of SRC of successors of basic block B.
References b, bitmap_clear(), bitmap_copy(), cfun, EDGE_COUNT, EDGE_SUCC, simple_bitmap_def::elms, EXIT_BLOCK_PTR_FOR_FN, i, r, SBITMAP_ELT_TYPE, and simple_bitmap_def::size.
|
extern |
Compute dominance frontiers, ala Harvey, Ferrante, et al. This algorithm can be found in Timothy Harvey's PhD thesis, at http://www.cs.rice.edu/~harv/dissertation.pdf in the section on iterative dominance algorithms. First, we identify each join point, j (any node with more than one incoming edge is a join point). We then examine each predecessor, p, of j and walk up the dominator tree starting at p. We stop the walk when we reach j's immediate dominator - j is in the dominance frontier of each of the nodes in the walk, except for j's immediate dominator. Intuitively, all of the rest of j's dominators are shared by j's predecessors as well. Since they dominate j, they will not have j in their dominance frontiers. The number of nodes touched by this algorithm is equal to the size of the dominance frontiers, no more, no less.
References b, bitmap_set_bit, CDI_DOMINATORS, cfun, EDGE_COUNT, ENTRY_BLOCK_PTR_FOR_FN, FOR_EACH_BB_FN, FOR_EACH_EDGE, get_immediate_dominator(), basic_block_def::index, timevar_pop(), and timevar_push().
Referenced by df_md_local_compute(), and update_ssa().
|
extern |
Given a set of blocks with variable definitions (DEF_BLOCKS), return a bitmap with all the blocks in the iterated dominance frontier of the blocks in DEF_BLOCKS. DFS contains dominance frontier information as returned by compute_dominance_frontiers. The resulting set of blocks are the potential sites where PHI nodes are needed. The caller is responsible for freeing the memory allocated for the return value.
References BITMAP_ALLOC, bitmap_clear_first_set_bit(), bitmap_copy(), bitmap_empty_p(), bitmap_set_bit, bitmap_tree_view(), cfun, EXECUTE_IF_SET_IN_BITMAP, gcc_checking_assert, i, last_basic_block_for_fn, and NULL.
Referenced by insert_phi_nodes(), and insert_updated_phi_nodes_for().
|
extern |
This function adds a fake edge between any noreturn block and infinite loops to the exit block. Some optimizations require a path from each node to the exit node. See also Morgan, Figure 3.10, pp. 82-83. The current implementation is ugly, not attempting to minimize the number of inserted fake edges. To reduce the number of fake edges to insert, add fake edges from _innermost_ loops containing only nodes not reachable from the exit block.
References add_noreturn_fake_exit_edges(), cfun, dfs_find_deadend(), EXIT_BLOCK_PTR_FOR_FN, make_edge(), and profile_probability::never().
Referenced by init_pre(), one_store_motion_pass(), rebuild_frequencies(), and tree_estimate_probability().
struct edge_list * create_edge_list | ( | void | ) |
Functions to access an edge list with a vector representation. Enough data is kept such that given an index number, the pred and succ that edge represents can be determined, or given a pred and a succ, its index number can be returned. This allows algorithms which consume a lot of memory to represent the normally full matrix of edge (pred,succ) with a single indexed vector, edge (EDGE_INDEX (pred, succ)), with no wasted space in the client code due to sparse flow graphs.
This functions initializes the edge list. Basically the entire flowgraph is processed, and all edges are assigned a number, and the data structure is filled in.
References cfun, EDGE_COUNT, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, FOR_BB_BETWEEN, FOR_EACH_EDGE, edge_list::index_to_edge, edge_list::num_edges, and basic_block_def::succs.
Referenced by branch_prob(), pre_edge_lcm_avs(), and pre_edge_rev_lcm().
|
extern |
Performs dfs search from BB over vertices satisfying PREDICATE; if REVERSE, go against direction of edges. Returns number of blocks found and their list in RSLT. RSLT can contain at most RSLT_MAX items.
References cfun, FOR_EACH_EDGE, free(), gcc_assert, MARK_VISITED, basic_block_def::preds, basic_block_def::succs, UNMARK_VISITED, visited, and VISITED_P.
Referenced by _loop_vec_info::_loop_vec_info(), determine_bb_domination_status(), find_path(), and get_loop_body_with_size().
|
extern |
Helper routine for inverted_rev_post_order_compute flow_dfs_compute_reverse_execute, and the reverse-CFG deapth first search in dominance.cc. BB has to belong to a region of CFG unreachable by inverted traversal from the exit. i.e. there's no control flow path from ENTRY to EXIT that contains this BB. This can happen in two cases - if there's an infinite loop or if there's a block that has no successor (call to a function with no return). Some RTL passes deal with this condition by calling connect_infinite_loops_to_exit () and/or add_noreturn_fake_exit_edges (). However, those methods involve modifying the CFG itself which may not be desirable. Hence, we deal with the infinite loop/no return cases by identifying a unique basic block that can reach all blocks in such a region by inverted traversal. This function returns a basic block that guarantees that all blocks in the region are reachable by starting an inverted traversal from the returned block.
References bitmap_set_bit, EDGE_COUNT, EDGE_SUCC, FOR_EACH_EDGE, basic_block_def::index, loop_exit_edge_p(), basic_block_def::loop_father, loop_outer(), basic_block_def::succs, and visited.
Referenced by connect_infinite_loops_to_exit(), and inverted_rev_post_order_compute().
edge find_edge | ( | basic_block | pred, |
basic_block | succ ) |
Given PRED and SUCC blocks, return the edge which connects the blocks. If no such edge exists, return NULL.
References EDGE_COUNT, FOR_EACH_EDGE, NULL, basic_block_def::preds, and basic_block_def::succs.
Referenced by add_phi_args_after_copy_edge(), tree_switch_conversion::switch_decision_tree::analyze_switch_statement(), associate_equivalences_with_edges(), branch_fixup(), tree_switch_conversion::switch_conversion::build_constructors(), bypass_block(), cached_make_edge(), tree_switch_conversion::switch_conversion::check_all_empty_except_final(), clean_up_after_unswitching(), cleanup_empty_eh_merge_phis(), path_range_query::compute_phi_relations(), path_range_query::compute_ranges_in_block(), cond_move_process_if_block(), convert_if_conditions_to_switch(), convert_single_case_switch(), copy_bbs(), copy_edges_for_bb(), copy_phis_for_bb(), create_cond_insert_point(), create_new_iv(), cse_extended_basic_block(), cse_find_path(), disambiguate_multiple_latches(), dump_gimple_switch(), back_jt_path_registry::duplicate_thread_path(), tree_switch_conversion::jump_table_cluster::emit(), evaluate_control_stmt_using_entry_checks(), execute_sm_if_changed(), execute_split_functions(), tree_switch_conversion::switch_conversion::exp_index_transform(), expand_case(), expand_complex_multiplication(), expand_omp_for_generic(), expand_omp_for_init_counts(), expand_omp_for_init_vars(), expand_omp_for_static_chunk(), expand_omp_for_static_nochunk(), expand_omp_simd(), expand_omp_taskloop_for_inner(), find_block_to_duplicate_for_splitting_paths(), find_implicit_erroneous_behavior(), find_implicit_sets(), find_taken_edge_computed_goto(), back_threader::find_taken_edge_switch(), find_taken_edge_switch_expr(), find_unswitching_predicates_for_bb(), fix_up_fall_thru_edges(), force_single_succ_latches(), tree_switch_conversion::switch_conversion::gather_default_values(), tree_switch_conversion::switch_conversion::gen_inbound_check(), get_cases_for_edge(), gimple_flow_call_edges_add(), gimple_lv_adjust_loop_header_phi(), gimple_redirect_edge_and_branch(), gimple_switch_edge(), group_case_labels_stmt(), ipa_simd_modify_function_body(), is_inconsistent(), loop_latch_edge(), lower_eh_dispatch(), make_edge(), make_edges(), make_forwarder_block(), fwd_jt_path_registry::mark_threaded_blocks(), maybe_optimize_range_tests(), move_sese_in_condition(), noce_convert_multiple_sets(), noce_process_if_block(), back_threader_profitability::possibly_profitable_path_p(), predicate_bbs(), propagate_freq(), prune_bbs_to_update_dominators(), redirect_edge_and_branch_force(), redirect_edge_succ_nodup(), back_threader_registry::register_path(), remove_unreachable::remove(), remove_unreachable::remove_and_update_globals(), remove_forwarder_block(), remove_forwarder_block_with_phi(), replace_block_by(), replace_phi_edge_with_variable(), back_jt_path_registry::rewire_first_differing_edge(), rtl_flow_call_edges_add(), same_phi_alternatives(), same_phi_args_p(), same_succ_hash(), simd_clone_adjust(), simplify_using_ranges::simplify_switch_using_ranges(), split_edge_bb_loc(), ssa_fix_duplicate_block_edges(), path_range_query::ssa_range_in_phi(), suitable_cond_bb(), jump_threader::thread_around_empty_blocks(), jump_threader::thread_through_normal_block(), transform_duplicate(), ubsan_expand_null_ifn(), unsplit_eh(), update_destination_phis(), update_profile_after_ifcombine(), update_ssa_across_abnormal_edges(), verify_eh_dispatch_edge(), verify_loop_structure(), and vt_initialize().
int find_edge_index | ( | struct edge_list * | edge_list, |
basic_block | pred, | ||
basic_block | succ ) |
This routine will determine what, if any, edge there is between a specified predecessor and successor.
References EDGE_INDEX_NO_EDGE, INDEX_EDGE_PRED_BB, INDEX_EDGE_SUCC_BB, and NUM_EDGES.
|
extern |
Find unreachable blocks. An unreachable block will have 0 in the reachable bit in block->flags. A nonzero value indicates the block is reachable.
References b, cfun, ENTRY_BLOCK_PTR_FOR_FN, basic_block_def::flags, FOR_EACH_BB_FN, FOR_EACH_EDGE, free(), n_basic_blocks_for_fn, and worklist.
Referenced by delete_unreachable_blocks(), delete_unreachable_blocks_update_callgraph(), eliminate_unnecessary_stmts(), and verify_no_unreachable_blocks().
void free_edge_list | ( | struct edge_list * | elist | ) |
This function free's memory associated with an edge list.
References free(), and edge_list::index_to_edge.
Referenced by branch_prob(), one_pre_gcse_pass(), and one_store_motion_pass().
|
extern |
Compute the reverse top sort order of the inverted CFG i.e. starting from the exit block and following the edges backward (from successors to predecessors). This ordering can be used for forward dataflow problems among others. Optionally if START_POINTS is specified, start from exit block and all basic blocks in START_POINTS. This is used by CD-DCE. This function assumes that all blocks in the CFG are reachable from the ENTRY (but not necessarily from EXIT). If there's an infinite loop, a simple inverted traversal starting from the blocks with no successors can't visit all blocks. To solve this problem, we first do inverted traversal starting from the blocks with no successor. And if there's any block left that's not visited by the regular inverted traversal from EXIT, those blocks are in such problematic region. Among those, we find one block that has any visited predecessor (which is an entry into such a region), and start looking for a "dead end" from that block and do another inverted traversal from that block.
References bitmap_bit_p, bitmap_clear(), bitmap_set_bit, cfun, dfs_find_deadend(), EDGE_COUNT, ei_edge(), ei_next(), ei_one_before_end_p(), ei_start, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN, FOR_ALL_BB_FN, FOR_BB_BETWEEN, FOR_EACH_EDGE, gcc_assert, basic_block_def::index, last_basic_block_for_fn, n_basic_blocks_for_fn, NULL, basic_block_def::preds, basic_block_def::succs, verify_no_unreachable_blocks(), and visited.
Referenced by compute_antic(), compute_antinout_edge(), df_analyze(), lra_create_live_ranges_1(), and remove_dead_stmt().
Mark the back edges in DFS traversal. Return nonzero if a loop (natural or otherwise) is present. Inspired by Depth_First_Search_PP described in: Advanced Compiler Design and Implementation Steven Muchnick Morgan Kaufmann, 1997 and heavily borrowed from pre_and_rev_post_order_compute.
References bitmap_bit_p, bitmap_clear(), bitmap_set_bit, EDGE_COUNT, ei_edge(), ei_next(), ei_one_before_end_p(), ei_start, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, basic_block_def::flags, free(), basic_block_def::index, last_basic_block_for_fn, n_basic_blocks_for_fn, basic_block_def::succs, and visited.
|
extern |
References cfun, and mark_dfs_back_edges().
Referenced by back_threader::back_threader(), bypass_conditional_jumps(), cleanup_tree_cfg_noloop(), draw_cfg_edges(), estimate_bb_frequencies(), execute_split_functions(), execute_split_paths(), find_always_executed_bbs(), find_conditions(), find_rarely_executed_basic_blocks_and_crossing_edges(), finite_function_p(), insert_backedge_copies(), mark_dfs_back_edges(), perform_tree_ssa_dce(), reorder_basic_blocks(), and verify_marked_backedges().
|
extern |
Compute reverse top sort order. This is computing a post order numbering of the graph. If INCLUDE_ENTRY_EXIT is true, then ENTRY_BLOCK and EXIT_BLOCK are included. If DELETE_UNREACHABLE is true, unreachable blocks are deleted.
References b, bitmap_bit_p, bitmap_clear(), bitmap_set_bit, cfun, count, delete_basic_block(), EDGE_COUNT, ei_edge(), ei_next(), ei_one_before_end_p(), ei_start, ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN, basic_block_def::index, last_basic_block_for_fn, n_basic_blocks_for_fn, basic_block_def::next_bb, basic_block_def::succs, tidy_fallthru_edges(), and visited.
Referenced by df_analyze(), and fwd_jt_path_registry::update_cfg().
|
extern |
Like pre_and_rev_post_order_compute_fn but operating on the current function and asserting that all nodes were visited.
References cfun, gcc_assert, n_basic_blocks_for_fn, NUM_FIXED_BLOCKS, and pre_and_rev_post_order_compute_fn().
Referenced by add_scope_conflicts(), analyze_function_body(), cse_main(), flow_loops_find(), init_alias_analysis(), init_reassoc(), insert(), regrename_analyze(), tree_lower_complex(), and dom_walker::walk().
|
extern |
Compute the depth first search order of FN and store in the array PRE_ORDER if nonzero. If REV_POST_ORDER is nonzero, return the reverse completion number for each node. Returns the number of nodes visited. A depth first search tries to get as far away from the starting point as quickly as possible. In case the function has unreachable blocks the number of nodes visited does not include them. pre_order is a really a preorder numbering of the graph. rev_post_order is really a reverse postorder numbering of the graph.
References BASIC_BLOCK_FOR_FN, EDGE_COUNT, ei_edge(), ei_next(), ei_one_before_end_p(), ei_start, ENTRY_BLOCK, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK, EXIT_BLOCK_PTR_FOR_FN, basic_block_def::flags, i, basic_block_def::index, n_basic_blocks_for_fn, NUM_FIXED_BLOCKS, basic_block_def::succs, and visited.
Referenced by compute_available(), compute_laterin(), compute_live_vars(), draw_cfg_nodes_no_loops(), loop_invariant_motion_in_fun(), pre_and_rev_post_order_compute(), sort_sibling_loops(), and ssa_prop_init().
void print_edge_list | ( | FILE * | f, |
struct edge_list * | elist ) |
This function provides debug output showing an edge list.
References cfun, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, INDEX_EDGE_PRED_BB, INDEX_EDGE_SUCC_BB, n_basic_blocks_for_fn, and edge_list::num_edges.
Referenced by pre_edge_lcm_avs(), and pre_edge_rev_lcm().
|
extern |
This routine will remove all fake edges from the flow graph. If we remove all fake successors, it will automatically remove all fake predecessors.
References cfun, ENTRY_BLOCK_PTR_FOR_FN, FOR_BB_BETWEEN, NULL, and remove_fake_predecessors().
Referenced by branch_prob().
|
extern |
This routine will remove all fake edges to the EXIT_BLOCK.
References cfun, EXIT_BLOCK_PTR_FOR_FN, and remove_fake_predecessors().
Referenced by cleanup_cfg(), one_pre_gcse_pass(), one_store_motion_pass(), rebuild_frequencies(), and tree_estimate_probability().
|
extern |
Compute the reverse completion number of a depth first search on the SEME region denoted by the ENTRY edge and the EXIT_BBS set of exit block indexes and store it in the array REV_POST_ORDER. Also sets the EDGE_DFS_BACK edge flags according to this visitation order. Returns the number of nodes visited. In case the function has unreachable blocks the number of nodes visited does not include them. If FOR_ITERATION is true then compute an RPO where SCCs form a contiguous region in the RPO array. *TOPLEVEL_SCC_EXTENTS if not NULL is filled with pairs of *REV_POST_ORDER indexes denoting extents of the toplevel SCCs in this region.
References BASIC_BLOCK_FOR_FN, bitmap_bit_p, cmp_edge_dest_pre(), EDGE_COUNT, EDGE_SUCC, ei_edge(), ei_end_p(), ei_next(), ei_start, basic_block_def::flags, FOR_EACH_EDGE, gcc_assert, gcc_checking_assert, gcc_sort_r(), i, basic_block_def::index, last_basic_block_for_fn, n_basic_blocks_for_fn, basic_block_def::succs, tag_header(), and visited.
Referenced by loop_distribution::bb_top_order_init(), do_rpo_vn_1(), vect_slp_function(), and vt_find_locations().
|
extern |
|
extern |
Returns the list of basic blocks in the function in an order that guarantees that if a block X has just a single predecessor Y, then Y is after X in the ordering.
References bitmap_clear(), cfun, ENTRY_BLOCK_PTR_FOR_FN, FOR_EACH_BB_FN, gcc_assert, i, last_basic_block_for_fn, MARK_VISITED, n_basic_blocks_for_fn, NUM_FIXED_BLOCKS, single_pred(), single_pred_p(), visited, VISITED_P, and y.
Referenced by execute_over_cond_phis().
|
extern |
Ignoring loop backedges, if BB has precisely one incoming edge then return that edge. Otherwise return NULL. When IGNORE_NOT_EXECUTABLE is true, also ignore edges that are not marked as executable.
References CDI_DOMINATORS, dominated_by_p(), FOR_EACH_EDGE, NULL, and basic_block_def::preds.
Referenced by uncprop_dom_walker::before_dom_children(), pointer_equiv_analyzer::enter(), record_equivalences_from_incoming_edge(), and dom_opt_dom_walker::set_global_ranges_from_unreachable_edges().
void verify_edge_list | ( | FILE * | f, |
struct edge_list * | elist ) |
This function provides an internal consistency check of an edge list, verifying that all edges are present, and that there are no extra edges.
References cfun, EDGE_INDEX, EDGE_INDEX_NO_EDGE, ENTRY_BLOCK_PTR_FOR_FN, EXIT_BLOCK_PTR_FOR_FN, FOR_BB_BETWEEN, FOR_EACH_EDGE, basic_block_def::index, edge_iterator::index, INDEX_EDGE_PRED_BB, INDEX_EDGE_SUCC_BB, NULL, basic_block_def::preds, and basic_block_def::succs.
Referenced by pre_edge_lcm_avs(), and pre_edge_rev_lcm().
|
extern |
Return TRUE if EDGE_DFS_BACK is up to date for CFUN.
References FOR_EACH_BB_FN, FOR_EACH_EDGE, internal_error(), mark_dfs_back_edges(), and basic_block_def::succs.
|
extern |
Verify that there are no unreachable blocks in the current function.
References cfun, find_unreachable_blocks(), basic_block_def::flags, FOR_EACH_BB_FN, and gcc_assert.
Referenced by inverted_rev_post_order_compute().