GCC Middle and Back End API Reference
|
#include <tree-switch-conversion.h>
Public Member Functions | |
jump_table_cluster (vec< cluster * > &clusters, unsigned start, unsigned end) | |
cluster_type | get_type () final override |
void | emit (tree index_expr, tree index_type, tree default_label_expr, basic_block default_bb, location_t loc) final override |
tree | get_low () final override |
tree | get_high () final override |
void | debug () final override |
void | dump (FILE *f, bool details=false) final override |
virtual bool | is_single_value_p () |
Static Public Member Functions | |
static vec< cluster * > | find_jump_tables (vec< cluster * > &clusters) |
static bool | can_be_handled (const vec< cluster * > &clusters, unsigned start, unsigned end, unsigned HOST_WIDE_INT max_ratio, unsigned HOST_WIDE_INT comparison_count) |
static bool | is_beneficial (const vec< cluster * > &clusters, unsigned start, unsigned end) |
static unsigned int | case_values_threshold (void) |
static bool | is_enabled (void) |
static unsigned HOST_WIDE_INT | get_range (tree low, tree high) |
Data Fields | |
vec< simple_cluster * > | m_cases |
tree | m_case_label_expr |
basic_block | m_case_bb |
profile_probability | m_prob |
profile_probability | m_subtree_prob |
profile_probability | m_default_prob |
Concrete subclass of group_cluster representing a collection of cases to be implemented as a jump table. The "emit" vfunc generates a nested switch statement which is later lowered to a jump table.
|
inline |
|
static |
Return true when cluster starting at START and ending at END (inclusive) can build a jump-table.
References end(), tree_switch_conversion::group_cluster::get_high(), tree_switch_conversion::group_cluster::get_low(), tree_switch_conversion::cluster::get_range(), and HOST_WIDE_INT_M1U.
Referenced by find_jump_tables().
|
inlinestatic |
References targetm.
Referenced by find_jump_tables(), and is_beneficial().
|
inlinefinaloverridevirtualinherited |
Implements tree_switch_conversion::cluster.
References tree_switch_conversion::group_cluster::dump().
Dump content of a cluster.
Implements tree_switch_conversion::cluster.
References tree_switch_conversion::simple_cluster::get_comparison_count(), tree_switch_conversion::group_cluster::get_high(), tree_switch_conversion::group_cluster::get_low(), tree_switch_conversion::cluster::get_range(), tree_switch_conversion::cluster::get_type(), HOST_WIDE_INT_PRINT_DEC, i, tree_switch_conversion::JUMP_TABLE, tree_switch_conversion::group_cluster::m_cases, PRINT_CASE, and sc.
Referenced by tree_switch_conversion::group_cluster::debug().
|
finaloverridevirtual |
Emit GIMPLE code to handle the cluster.
Implements tree_switch_conversion::cluster.
References profile_probability::always(), profile_probability::apply_scale(), build_nonstandard_integer_type(), CASE_HIGH, CASE_LOW, cfun, const_binop(), const_unop(), find_edge(), fold_convert, g, tree_switch_conversion::group_cluster::get_high(), tree_switch_conversion::group_cluster::get_low(), GET_MODE_PRECISION(), tree_switch_conversion::cluster::get_range(), gimple_build(), gimple_build_cond(), gimple_build_switch(), gimple_convert(), gimple_seq_add_stmt(), gimple_seq_set_location(), gimple_set_location(), gimple_switch_default_edge(), gsi_bb(), gsi_insert_after(), gsi_insert_seq_after(), GSI_NEW_STMT, gsi_start_bb(), i, profile_probability::invert(), profile_probability::likely(), tree_switch_conversion::cluster::m_case_bb, tree_switch_conversion::cluster::m_case_label_expr, tree_switch_conversion::group_cluster::m_cases, make_edge(), profile_probability::never(), NULL, NULL_TREE, tree_switch_conversion::switch_decision_tree::reset_out_edges_aux(), sc, split_block(), TREE_CODE, TREE_TYPE, type(), TYPE_MAX_VALUE, TYPE_OVERFLOW_WRAPS, TYPE_PRECISION, unshare_expr(), and unsigned_type_for().
Find jump tables of given CLUSTERS, where all members of the vector are of type simple_cluster. New clusters are returned.
References can_be_handled(), case_values_threshold(), end(), gcc_checking_assert, tree_switch_conversion::simple_cluster::get_comparison_count(), i, INT_MAX, is_beneficial(), is_enabled(), optimize_insn_for_size_p(), and sc.
Referenced by tree_switch_conversion::switch_decision_tree::analyze_switch_statement(), and if_chain::is_beneficial().
|
inlinefinaloverridevirtualinherited |
Implements tree_switch_conversion::cluster.
References tree_switch_conversion::group_cluster::m_cases.
Referenced by tree_switch_conversion::bit_test_cluster::can_be_handled(), can_be_handled(), tree_switch_conversion::group_cluster::dump(), tree_switch_conversion::bit_test_cluster::emit(), and emit().
|
inlinefinaloverridevirtualinherited |
Implements tree_switch_conversion::cluster.
References tree_switch_conversion::group_cluster::m_cases.
Referenced by tree_switch_conversion::bit_test_cluster::can_be_handled(), can_be_handled(), tree_switch_conversion::group_cluster::dump(), tree_switch_conversion::bit_test_cluster::emit(), and emit().
|
inlinestaticinherited |
References wi::fits_uhwi_p(), wi::neg_p(), generic_wide_int< storage >::to_uhwi(), wi::to_wide(), TREE_TYPE, and TYPE_SIGN.
Referenced by tree_switch_conversion::bit_test_cluster::can_be_handled(), can_be_handled(), tree_switch_conversion::group_cluster::dump(), tree_switch_conversion::bit_test_cluster::emit(), emit(), and tree_switch_conversion::bit_test_cluster::find_bit_tests_fast().
|
inlinefinaloverridevirtual |
Implements tree_switch_conversion::cluster.
References tree_switch_conversion::JUMP_TABLE.
|
static |
Return true if cluster starting at START and ending at END (inclusive) is profitable transformation.
References case_values_threshold(), and end().
Referenced by find_jump_tables().
|
inlinestatic |
Return whether jump table expansion is allowed.
References targetm.
Referenced by find_jump_tables().
|
inlinevirtualinherited |
Reimplemented in tree_switch_conversion::simple_cluster.
Referenced by tree_switch_conversion::switch_decision_tree::emit_case_nodes().
|
inherited |
Referenced by tree_switch_conversion::bit_test_cluster::emit(), emit(), tree_switch_conversion::switch_decision_tree::emit_case_nodes(), tree_switch_conversion::bit_test_cluster::find_bit_tests_fast(), if_chain::is_beneficial(), and tree_switch_conversion::switch_decision_tree::try_switch_expansion().
|
inherited |
Referenced by tree_switch_conversion::bit_test_cluster::emit(), and emit().
|
inherited |
Referenced by tree_switch_conversion::group_cluster::dump(), tree_switch_conversion::bit_test_cluster::emit(), emit(), tree_switch_conversion::group_cluster::get_high(), tree_switch_conversion::group_cluster::get_low(), tree_switch_conversion::group_cluster::group_cluster(), and tree_switch_conversion::group_cluster::~group_cluster().
|
inherited |
|
inherited |
Referenced by tree_switch_conversion::switch_decision_tree::balance_case_nodes(), tree_switch_conversion::switch_decision_tree::dump_case_nodes(), tree_switch_conversion::bit_test_cluster::emit(), tree_switch_conversion::switch_decision_tree::emit_case_nodes(), and tree_switch_conversion::group_cluster::group_cluster().
|
inherited |
Referenced by tree_switch_conversion::switch_decision_tree::balance_case_nodes(), tree_switch_conversion::switch_decision_tree::dump_case_nodes(), tree_switch_conversion::bit_test_cluster::emit(), tree_switch_conversion::switch_decision_tree::emit_case_nodes(), and tree_switch_conversion::group_cluster::group_cluster().