On 4/28/2021 11:12 AM, Aldy Hernandez wrote:
This refactors the registry and the profitability code from the backwards threader into two separate classes. It cleans up the code, and makes it easier for alternate implementations to share code. Tested on x86-64 Linux. gcc/ChangeLog: * tree-ssa-threadbackward.c (class thread_jumps): Split out code from here... (class back_threader_registry): ...to here... (class back_threader_profitability): ...and here... (thread_jumps::thread_through_all_blocks): Remove argument. (back_threader_registry::back_threader_registry): New. (back_threader_registry::~back_threader_registry): New. (back_threader_registry::thread_through_all_blocks): New. (thread_jumps::profitable_jump_thread_path): Move from here... (back_threader_profitability::profitable_path_p): ...to here. (thread_jumps::find_taken_edge): New. (thread_jumps::convert_and_register_current_path): Move... (back_threader_registry::register_path): ...to here. (thread_jumps::register_jump_thread_path_if_profitable): Move... (thread_jumps::maybe_register_path): ...to here. (thread_jumps::handle_phi): Call find_taken_edge and maybe_register_path. (thread_jumps::handle_assignment): Same. (thread_jumps::fsm_find_control_statement_thread_paths): Remove tree argument to handle_phi and handle_assignment. (thread_jumps::find_jump_threads_backwards): Set m_name. Remove set of m_speed_p and m_max_threaded_paths. (pass_thread_jumps::execute): Remove second argument from find_jump_threads_backwards. (pass_early_thread_jumps::execute): Same.
OK. And if you wanted to pull any of that code into its own file, consider that pre-approved.
jeff