|
GCC Middle and Back End API Reference
|


Public Member Functions | |
| bool | register_path (const vec< basic_block > &, edge taken) |
| bool | register_jump_thread (vec< jump_thread_edge * > *) |
| bool | thread_through_all_blocks (bool peel_loop_headers) |
| void | push_edge (vec< jump_thread_edge * > *path, edge, jump_thread_edge_type) |
| vec< jump_thread_edge * > * | allocate_thread_path () |
| void | debug () |
Protected Member Functions | |
| void | debug_path (FILE *, int pathno) |
| void | remove_path (unsigned pathno) |
| void | remove_path (unsigned pathno, edge first) |
| void | add_first_edge (edge) |
| void | drop_first_edge (edge) |
| unsigned | first_edge_count (edge) |
Protected Attributes | |
| vec< vec< jump_thread_edge * > * > | m_paths |
| hash_map< edge, unsigned > | m_first_edge_counts |
| unsigned long | m_num_threaded_edges |
Private Member Functions | |
| bool | update_cfg (bool peel_loop_headers) override |
| void | adjust_paths_after_duplication (unsigned curr_path_num) |
| bool | duplicate_thread_path (edge entry, edge exit, basic_block *region, unsigned n_region, unsigned current_path_no, const char **failure_reason) |
| bool | rewire_first_differing_edge (unsigned path_num, unsigned edge_num) |
| bool | adjust_one_path (vec< jump_thread_edge * > *curr_path, unsigned cand_path_num) |
| bool | cancel_invalid_paths (vec< jump_thread_edge * > &path) |
| DISABLE_COPY_AND_ASSIGN (jt_path_registry) | |
Private Attributes | |
| jump_thread_path_allocator | m_allocator |
| bool | m_backedge_threads |
SSA Jump Threading Copyright (C) 2005-2026 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 3, 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 COPYING3. If not see <http://www.gnu.org/licenses/>.
|
protectedinherited |
Note that one more registered path starts on E.
References hash_map< KeyId, Value, Traits >::get_or_insert(), and m_first_edge_counts.
Referenced by back_jt_path_registry::adjust_one_path(), and register_jump_thread().
|
privateinherited |
Adjust the candidate path CAND_PATH_NUM, which starts on the same edge as the path we have just threaded, so it can be threaded within the context of the copies that threading made. CURR_PATH is the path that was threaded. Returns TRUE if the candidate survived. If it did not, it has been removed from the registry and a different path now sits in its slot.
References jt_path_registry::add_first_edge(), cancel_thread(), jt_path_registry::debug_path(), jt_path_registry::drop_first_edge(), dump_file, dump_flags, gcc_assert, jt_path_registry::m_paths, MIN, jt_path_registry::remove_path(), rewire_first_differing_edge(), and TDF_DETAILS.
Referenced by adjust_paths_after_duplication().
|
privateinherited |
After a path has been jump threaded, adjust the remaining paths that are subsets of this path, so these paths can be safely threaded within the context of the new threaded path. For example, suppose we have just threaded: 5 -> 6 -> 7 -> 8 -> 12 => 5 -> 6' -> 7' -> 8' -> 12' And we have an upcoming threading candidate: 5 -> 6 -> 7 -> 8 -> 15 -> 20 This function adjusts the upcoming path into: 8' -> 15 -> 20 CURR_PATH_NUM is an index into the global paths table. It specifies the path that was just threaded.
References adjust_one_path(), jt_path_registry::first_edge_count(), i, and jt_path_registry::m_paths.
Referenced by duplicate_thread_path().
|
inherited |
References jump_thread_path_allocator::allocate_thread_path(), and m_allocator.
Referenced by back_threader_registry::register_path(), and jump_threader::thread_across_edge().
|
privateinherited |
References cancel_thread(), cfun, empty_block_p(), flow_loop_nested_p(), gcc_assert, gcc_checking_assert, loop::header, i, loop::latch, m_backedge_threads, NULL, and PROP_loop_opts_done.
Referenced by register_jump_thread(), and update_cfg().
|
inherited |
References debug_path(), i, and m_paths.
|
protectedinherited |
References dump_file, i, and m_paths.
Referenced by back_jt_path_registry::adjust_one_path(), and debug().
|
privateinherited |
References jt_path_registry().
|
protectedinherited |
Note that one fewer registered path starts on E.
References gcc_checking_assert, hash_map< KeyId, Value, Traits >::get(), m_first_edge_counts, and hash_map< KeyId, Value, Traits >::remove().
Referenced by back_jt_path_registry::adjust_one_path(), and remove_path().
|
privateinherited |
Duplicates a jump-thread path of N_REGION basic blocks. The ENTRY edge is redirected to the duplicate of the region. Remove the last conditional statement in the last basic block in the REGION, and create a single fallthru edge pointing to the same destination as the EXIT edge. CURRENT_PATH_NO is an index into the global paths[] table specifying the jump-thread path. Returns false if it is unable to copy the region, true otherwise. On failure *FAILURE_REASON says why.
References add_phi_args_after_copy(), adjust_paths_after_duplication(), profile_probability::always(), bb_in_bbs(), can_copy_bbs_p(), copy_bbs(), basic_block_def::count, EDGE_COUNT, find_edge(), flush_pending_stmts(), FOR_EACH_EDGE, free(), free_original_copy_tables(), gcc_assert, gcc_checking_assert, get_bb_copy(), get_bb_original(), loop::header, i, initialize_original_copy_tables(), profile_count::initialized_p(), loop_exit_edge_p(), make_edge(), mark_loop_for_removal(), NULL, redirect_edge_and_branch(), redirect_edge_and_branch_force(), remove_ctrl_stmt_and_useless_edges(), rescan_loop_exit(), scale_bbs_frequencies_profile_count(), set_loop_copy(), single_succ_edge(), single_succ_p(), split_edge_bb_loc(), basic_block_def::succs, update_bb_profile_for_threading(), and verify_jump_thread().
Referenced by update_cfg().
|
protectedinherited |
How many registered paths start on E.
References gcc_checking_assert, hash_map< KeyId, Value, Traits >::get(), and m_first_edge_counts.
Referenced by back_jt_path_registry::adjust_paths_after_duplication().
|
inherited |
|
inherited |
Register a jump threading opportunity. We queue up all the jump threading opportunities discovered by a pass and update the CFG and SSA form all at once. E is the edge we can thread, E2 is the new target edge, i.e., we are effectively recording that E->dest can be changed to E2->dest after fixing the SSA graph. Return TRUE if PATH was successfully threaded.
References add_first_edge(), cancel_invalid_paths(), dbg_cnt(), dump_file, dump_flags, dump_jump_thread_path(), gcc_checking_assert, m_paths, and TDF_DETAILS.
Referenced by back_threader_registry::register_path(), and jump_threader::thread_across_edge().
| bool back_threader_registry::register_path | ( | const vec< basic_block > & | m_path, |
| edge | taken_edge ) |
The current path PATH is a vector of blocks forming a jump threading path in reverse order. TAKEN_EDGE is the edge taken from path[0]. Convert the current path into the form used by register_jump_thread and register it. Return TRUE if successful or FALSE otherwise.
References jt_path_registry::allocate_thread_path(), EDGE_COPY_SRC_BLOCK, EDGE_NO_COPY_SRC_BLOCK, find_edge(), gcc_assert, jt_path_registry::push_edge(), and jt_path_registry::register_jump_thread().
Referenced by back_threader::maybe_register_path().
|
protectedinherited |
Drop path PATHNO, keeping the first-edge counts in step.
References m_paths, and remove_path().
Referenced by back_jt_path_registry::adjust_one_path(), fwd_jt_path_registry::mark_threaded_blocks(), remove_path(), back_jt_path_registry::update_cfg(), and fwd_jt_path_registry::update_cfg().
|
protectedinherited |
Drop path PATHNO, which started on FIRST, keeping the first-edge counts in step. For callers whose path has already been released.
References drop_first_edge(), and m_paths.
|
privateinherited |
Rewire a jump_thread_edge so that the source block is now a threaded source block. PATH_NUM is an index into the global path table PATHS. EDGE_NUM is the jump thread edge number into said path. Returns TRUE if we were able to successfully rewire the edge.
References dump_file, dump_flags, find_edge(), get_bb_copy(), jt_path_registry::m_paths, NULL, and TDF_DETAILS.
Referenced by adjust_one_path().
Thread all paths that have been queued for jump threading, and update the CFG accordingly. It is the caller's responsibility to fix the dominance information and rewrite duplicated SSA_NAMEs back into SSA form. If PEEL_LOOP_HEADERS is false, avoid threading edges through loop headers if it does not simplify the loop. Returns true if one or more edges were threaded.
References cfun, LOOPS_NEED_FIXUP, loops_state_set(), m_num_threaded_edges, m_paths, statistics_counter_event(), and update_cfg().
Referenced by back_threader::thread_blocks(), and jump_threader::thread_through_all_blocks().
This is the backward threader version of thread_through_all_blocks using a generic BB copier.
Implements jt_path_registry.
References hash_set< KeyId, Lazy, Traits >::add(), cancel_thread(), CDI_DOMINATORS, hash_set< KeyId, Lazy, Traits >::contains(), duplicate_thread_path(), free(), free_dominance_info(), jt_path_registry::m_num_threaded_edges, jt_path_registry::m_paths, NULL, jt_path_registry::remove_path(), and valid_jump_thread_path().
|
privateinherited |
Referenced by allocate_thread_path(), and push_edge().
|
privateinherited |
Referenced by cancel_invalid_paths(), and jt_path_registry().
Referenced by add_first_edge(), drop_first_edge(), and first_edge_count().
|
protectedinherited |
|
protectedinherited |
Referenced by back_jt_path_registry::adjust_one_path(), back_jt_path_registry::adjust_paths_after_duplication(), debug(), debug_path(), jt_path_registry(), fwd_jt_path_registry::mark_threaded_blocks(), register_jump_thread(), fwd_jt_path_registry::remove_jump_threads_including(), remove_path(), remove_path(), back_jt_path_registry::rewire_first_differing_edge(), thread_through_all_blocks(), back_jt_path_registry::update_cfg(), fwd_jt_path_registry::update_cfg(), and ~jt_path_registry().