20#ifndef TREE_SWITCH_CONVERSION_H
21#define TREE_SWITCH_CONVERSION_H
34#define PRINT_CASE(f,c) print_generic_expr (f, c)
71 virtual void dump (FILE *f,
bool details =
false) = 0;
116 m_case_label_expr (case_label_expr), m_case_bb (case_bb), m_prob (prob),
117 m_subtree_prob (subtree_prob),
131 bool has_forward_bb =
false);
167 dump (FILE *f,
bool details ATTRIBUTE_UNUSED =
false)
final override
210 bool has_forward_bb):
211 cluster (case_label_expr, case_bb, prob, prob),
212 m_low (low), m_high (high), m_has_forward_bb (has_forward_bb)
249 void dump (FILE *f,
bool details =
false)
final override;
286 static bool can_be_handled (
const vec<cluster *> &clusters,
unsigned start,
287 unsigned end,
unsigned HOST_WIDE_INT max_ratio,
288 unsigned HOST_WIDE_INT comparison_count);
292 static bool is_beneficial (
const vec<cluster *> &clusters,
unsigned start,
297 static inline unsigned int case_values_threshold (
void);
300 static inline bool is_enabled (
void);
369 bool handles_entire_switch)
371 m_handles_entire_switch (handles_entire_switch)
410 static bool can_be_handled (
const vec<cluster *> &clusters,
unsigned start,
415 static bool is_beneficial (
unsigned count,
unsigned uniq);
419 static bool is_beneficial (
const vec<cluster *> &clusters,
unsigned start,
445 return flag_bit_tests;
453 static const int m_max_case_bit_tests = 3;
463 m_count (
count), m_start (start), m_non_jt_cases (non_jt_cases)
487 return m_left !=
NULL || m_right !=
NULL;
512 unsigned int threshold = param_case_values_threshold;
515 threshold =
targetm.case_values_threshold ();
527 if (!flag_jump_tables)
529#ifndef ASM_OUTPUT_ADDR_DIFF_ELT
557 static int cmp (
const void *p1,
const void *p2);
606 tree index_type, location_t);
943 for (
unsigned i = 0;
i < clusters.length ();
i++)
#define FOR_EACH_EDGE(EDGE, ITER, EDGE_VEC)
Definition basic-block.h:487
static bbro_basic_block_data * bbd
Definition bb-reorder.cc:177
unsigned HOST_WIDE_INT to_uhwi(unsigned int) const
Definition wide-int.h:887
Definition alloc-pool.h:482
Definition profile-count.h:147
Definition tree-switch-conversion.h:365
bool m_handles_entire_switch
Definition tree-switch-conversion.h:449
static bool is_enabled(void)
Definition tree-switch-conversion.h:443
bit_test_cluster(vec< cluster * > &clusters, unsigned start, unsigned end, bool handles_entire_switch)
Definition tree-switch-conversion.h:368
cluster_type get_type() final override
Definition tree-switch-conversion.h:375
static bool can_be_handled(unsigned HOST_WIDE_INT range, unsigned uniq)
Definition tree-switch-conversion.h:547
wide_int mask
Definition tree-switch-conversion.h:549
basic_block target_bb
Definition tree-switch-conversion.h:550
tree label
Definition tree-switch-conversion.h:551
int bits
Definition tree-switch-conversion.h:552
profile_probability prob
Definition tree-switch-conversion.h:553
static int cmp(const void *p1, const void *p2)
Definition tree-switch-conversion.cc:1929
Definition tree-switch-conversion.h:479
case_tree_node * m_right
Definition tree-switch-conversion.h:494
case_tree_node * m_parent
Definition tree-switch-conversion.h:497
bool has_child()
Definition tree-switch-conversion.h:485
case_tree_node * m_left
Definition tree-switch-conversion.h:491
cluster * m_c
Definition tree-switch-conversion.h:500
case_tree_node()
Definition tree-switch-conversion.h:504
Definition tree-switch-conversion.h:48
profile_probability m_default_prob
Definition tree-switch-conversion.h:107
virtual void dump(FILE *f, bool details=false)=0
static unsigned HOST_WIDE_INT get_range(tree low, tree high)
Definition tree-switch-conversion.h:85
virtual void emit(tree, tree, tree, basic_block, location_t)=0
cluster()
Definition tree-switch-conversion.h:111
virtual bool is_single_value_p()
Definition tree-switch-conversion.h:78
virtual tree get_high()=0
profile_probability m_prob
Definition tree-switch-conversion.h:100
tree m_case_label_expr
Definition tree-switch-conversion.h:94
virtual ~cluster()
Definition tree-switch-conversion.h:55
virtual cluster_type get_type()=0
basic_block m_case_bb
Definition tree-switch-conversion.h:97
profile_probability m_subtree_prob
Definition tree-switch-conversion.h:103
Definition tree-switch-conversion.h:223
group_cluster(vec< cluster * > &clusters, unsigned start, unsigned end)
Definition tree-switch-conversion.cc:1459
vec< simple_cluster * > m_cases
Definition tree-switch-conversion.h:252
~group_cluster()
Definition tree-switch-conversion.cc:1475
void debug() final override
Definition tree-switch-conversion.h:244
tree get_high() final override
Definition tree-switch-conversion.h:238
void dump(FILE *f, bool details=false) final override
Definition tree-switch-conversion.cc:1486
tree get_low() final override
Definition tree-switch-conversion.h:232
Definition tree-switch-conversion.h:261
jump_table_cluster(vec< cluster * > &clusters, unsigned start, unsigned end)
Definition tree-switch-conversion.h:264
cluster_type get_type() final override
Definition tree-switch-conversion.h:269
static bool is_enabled(void)
Definition tree-switch-conversion.h:521
static unsigned int case_values_threshold(void)
Definition tree-switch-conversion.h:510
Definition tree-switch-conversion.h:459
min_cluster_item(unsigned count, unsigned start, unsigned non_jt_cases)
Definition tree-switch-conversion.h:462
unsigned m_start
Definition tree-switch-conversion.h:470
unsigned m_count
Definition tree-switch-conversion.h:467
unsigned m_non_jt_cases
Definition tree-switch-conversion.h:473
Definition tree-switch-conversion.h:126
void emit(tree, tree, tree, basic_block, location_t) final override
Definition tree-switch-conversion.h:178
simple_cluster(tree low, tree high, tree case_label_expr, basic_block case_bb, profile_probability prob, bool has_forward_bb=false)
Definition tree-switch-conversion.h:208
~simple_cluster()
Definition tree-switch-conversion.h:134
void debug() final override
Definition tree-switch-conversion.h:161
void set_high(tree high)
Definition tree-switch-conversion.h:155
bool is_single_value_p() final override
Definition tree-switch-conversion.h:183
bool m_range_p
Definition tree-switch-conversion.h:202
tree get_low() final override
Definition tree-switch-conversion.h:144
tree m_low
Definition tree-switch-conversion.h:196
bool m_has_forward_bb
Definition tree-switch-conversion.h:205
tree m_high
Definition tree-switch-conversion.h:199
unsigned get_comparison_count()
Definition tree-switch-conversion.h:190
cluster_type get_type() final override
Definition tree-switch-conversion.h:138
tree get_high() final override
Definition tree-switch-conversion.h:150
void dump(FILE *f, bool details=false) final override
Definition tree-switch-conversion.h:167
Definition tree-switch-conversion.h:728
basic_block m_switch_bb
Definition tree-switch-conversion.h:857
int m_phi_count
Definition tree-switch-conversion.h:870
gimple * m_arr_ref_last
Definition tree-switch-conversion.h:894
unsigned int m_count
Definition tree-switch-conversion.h:912
tree * m_target_outbound_names
Definition tree-switch-conversion.h:884
bool m_exp_index_transform_applied
Definition tree-switch-conversion.h:920
bool contains_linear_function_p(vec< constructor_elt, va_gc > *vec, wide_int *coeff_a, wide_int *coeff_b)
Definition tree-switch-conversion.cc:821
gimple * m_arr_ref_first
Definition tree-switch-conversion.h:891
gassign * gen_def_assigns(gimple_stmt_iterator *gsi)
Definition tree-switch-conversion.cc:1131
tree m_range_min
Definition tree-switch-conversion.h:848
void expand(gswitch *swtch)
Definition tree-switch-conversion.cc:1357
void build_constructors()
Definition tree-switch-conversion.cc:740
tree array_value_type(tree type, int num)
Definition tree-switch-conversion.cc:881
tree m_range_max
Definition tree-switch-conversion.h:849
void create_temp_arrays()
Definition tree-switch-conversion.cc:688
void exp_index_transform(gswitch *swtch)
Definition tree-switch-conversion.cc:398
void gather_default_values(tree default_case)
Definition tree-switch-conversion.cc:709
void build_one_array(int num, tree arr_index_type, gphi *phi, tree tidx)
Definition tree-switch-conversion.cc:967
tree m_index_expr
Definition tree-switch-conversion.h:844
tree * m_target_inbound_names
Definition tree-switch-conversion.h:880
bool m_default_case_nonstandard
Definition tree-switch-conversion.h:906
bool check_range()
Definition tree-switch-conversion.cc:553
tree * m_default_values
Definition tree-switch-conversion.h:876
void collect(gswitch *swtch)
Definition tree-switch-conversion.cc:180
basic_block m_final_bb
Definition tree-switch-conversion.h:864
const char * m_reason
Definition tree-switch-conversion.h:898
void fix_phi_nodes(edge e1f, edge e2f, basic_block bbf)
Definition tree-switch-conversion.cc:1176
~switch_conversion()
Definition tree-switch-conversion.cc:1451
void build_arrays()
Definition tree-switch-conversion.cc:1059
switch_conversion()
Definition tree-switch-conversion.cc:169
basic_block m_default_bb
Definition tree-switch-conversion.h:860
bool check_all_empty_except_final()
Definition tree-switch-conversion.cc:575
tree m_range_size
Definition tree-switch-conversion.h:854
tree m_exp_index_transform_log2_type
Definition tree-switch-conversion.h:925
unsigned int m_uniq
Definition tree-switch-conversion.h:909
bool m_contiguous_range
Definition tree-switch-conversion.h:902
bool check_final_bb()
Definition tree-switch-conversion.cc:607
profile_probability m_default_prob
Definition tree-switch-conversion.h:867
bool is_exp_index_transform_viable(gswitch *swtch)
Definition tree-switch-conversion.cc:321
void gen_inbound_check()
Definition tree-switch-conversion.cc:1204
void prune_bbs(basic_block bbd, basic_block final, basic_block default_bb)
Definition tree-switch-conversion.cc:1153
tree m_target_vop
Definition tree-switch-conversion.h:887
bool m_cfg_altered
Definition tree-switch-conversion.h:915
gswitch * m_switch
Definition tree-switch-conversion.h:841
vec< constructor_elt, va_gc > ** m_constructors
Definition tree-switch-conversion.h:873
Definition tree-switch-conversion.h:561
void fix_phi_operands_for_edges()
Definition tree-switch-conversion.cc:2429
static void dump_case_nodes(FILE *f, case_tree_node *root, int indent_step, int indent_level)
Definition tree-switch-conversion.cc:2578
static void emit_jump(basic_block bb, basic_block case_bb)
Definition tree-switch-conversion.cc:2602
static basic_block do_jump_if_equal(basic_block bb, tree op0, tree op1, basic_block label_bb, profile_probability prob, location_t)
Definition tree-switch-conversion.cc:2647
static void balance_case_nodes(case_tree_node **head, case_tree_node *parent)
Definition tree-switch-conversion.cc:2502
static void reset_out_edges_aux(gswitch *swtch)
Definition tree-switch-conversion.h:929
void record_phi_operand_mapping()
Definition tree-switch-conversion.cc:2398
bool try_switch_expansion(vec< cluster * > &clusters)
Definition tree-switch-conversion.cc:2312
hash_map< tree, tree > m_phi_mapping
Definition tree-switch-conversion.h:651
switch_decision_tree(gswitch *swtch)
Definition tree-switch-conversion.h:564
void emit(basic_block bb, tree index_expr, profile_probability default_prob, tree index_type)
Definition tree-switch-conversion.cc:2462
case_tree_node * m_case_list
Definition tree-switch-conversion.h:663
gswitch * m_switch
Definition tree-switch-conversion.h:648
bool analyze_switch_statement()
Definition tree-switch-conversion.cc:2227
object_allocator< case_tree_node > m_case_node_pool
Definition tree-switch-conversion.h:660
basic_block m_default_bb
Definition tree-switch-conversion.h:657
static basic_block emit_cmp_and_jump_insns(basic_block bb, tree op0, tree op1, tree_code comparison, basic_block label_bb, profile_probability prob, location_t)
Definition tree-switch-conversion.cc:2614
void compute_cases_per_edge()
Definition tree-switch-conversion.cc:2212
basic_block emit_case_nodes(basic_block bb, tree index, case_tree_node *node, profile_probability default_prob, tree index_type, location_t)
Definition tree-switch-conversion.cc:2680
auto_vec< basic_block > m_case_bbs
Definition tree-switch-conversion.h:654
class edge_def * edge
Definition coretypes.h:352
union tree_node * tree
Definition coretypes.h:97
static unsigned int count[debug_counter_number_of_counters]
Definition dbgcnt.cc:50
rtx_insn * emit(rtx x, bool allow_barrier_p)
Definition emit-rtl.cc:5604
void final(rtx_insn *first, FILE *file, int optimize_p)
Definition final.cc:2002
tree_code
Definition genmatch.cc:347
basic_block gimple_bb(const gimple *g)
Definition gimple.h:1856
Definition tree-switch-conversion.h:23
void release_clusters(vec< cluster * > &clusters)
Definition tree-switch-conversion.h:941
cluster_type
Definition tree-switch-conversion.h:28
@ BIT_TEST
Definition tree-switch-conversion.h:31
@ JUMP_TABLE
Definition tree-switch-conversion.h:30
@ SIMPLE_CASE
Definition tree-switch-conversion.h:29
UNARY_PREDICATE neg_p(const T &, signop=SIGNED)
UNARY_PREDICATE fits_uhwi_p(const T &)
tree_to_wide_ref to_wide(const_tree)
Definition tree.h:6388
i
Definition poly-int.h:776
Definition basic-block.h:117
vec< edge, va_gc > * succs
Definition basic-block.h:120
Definition compare-elim.cc:91
Definition basic-block.h:366
Definition gimple-iterator.h:26
Definition collect2.cc:175
Definition gengtype.h:252
#define NULL
Definition system.h:50
#define gcc_unreachable()
Definition system.h:848
struct gcc_target targetm
#define PRINT_CASE(f, c)
Definition tree-switch-conversion.h:34
bool tree_int_cst_equal(const_tree t1, const_tree t2)
Definition tree.cc:6388
#define TYPE_SIGN(NODE)
Definition tree.h:952
#define TREE_TYPE(NODE)
Definition tree.h:512
T * end(vec< T, A, L > *v)
Definition vec.h:457