diff options
author | Martin Liska <mliska@suse.cz> | 2018-06-20 10:52:35 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-06-20 08:52:35 +0000 |
commit | 2f928c1b63e67155f4b3c194e3a9cc53fb6fb107 (patch) | |
tree | 3ee984a0b04610c608331e71554ad3b54cb70c9d /gcc/tree-switch-conversion.h | |
parent | dc223ad48971b2d2b1e4bcfbbb47a96354e3d2ea (diff) | |
download | gcc-2f928c1b63e67155f4b3c194e3a9cc53fb6fb107.zip gcc-2f928c1b63e67155f4b3c194e3a9cc53fb6fb107.tar.gz gcc-2f928c1b63e67155f4b3c194e3a9cc53fb6fb107.tar.bz2 |
Enable clustering for switch statements.
2018-06-20 Martin Liska <mliska@suse.cz>
* tree-switch-conversion.c (jump_table_cluster::find_jump_tables):
New.
(bit_test_cluster::find_bit_tests): Likewise.
(switch_decision_tree::analyze_switch_statement): Find clusters.
* tree-switch-conversion.h (struct jump_table_cluster): Document
hierarchy.
From-SVN: r261794
Diffstat (limited to 'gcc/tree-switch-conversion.h')
-rw-r--r-- | gcc/tree-switch-conversion.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h index 946077c..0335283 100644 --- a/gcc/tree-switch-conversion.h +++ b/gcc/tree-switch-conversion.h @@ -33,7 +33,16 @@ enum cluster_type #define PRINT_CASE(f,c) print_generic_expr (f, c) -/* Abstract base class for representing a cluster of cases. */ +/* Abstract base class for representing a cluster of cases. + + Here is the inheritance hierarachy, and the enum_cluster_type + values for the concrete subclasses: + + cluster + |-simple_cluster (SIMPLE_CASE) + `-group_cluster + |-jump_table_cluster (JUMP_TABLE) + `-bit_test_cluster (BIT_TEST). */ struct cluster { @@ -228,6 +237,10 @@ struct jump_table_cluster: public group_cluster void emit (tree index_expr, tree index_type, tree default_label_expr, basic_block default_bb); + /* Find jump tables of given CLUSTERS, where all members of the vector + are of type simple_cluster. New clusters are returned. */ + static vec<cluster *> find_jump_tables (vec<cluster *> &clusters); + /* Return true when cluster starting at START and ending at END (inclusive) can build a jump-table. */ static bool can_be_handled (const vec<cluster *> &clusters, unsigned start, @@ -336,6 +349,10 @@ struct bit_test_cluster: public group_cluster void emit (tree index_expr, tree index_type, tree default_label_expr, basic_block default_bb); + /* Find bit tests of given CLUSTERS, where all members of the vector + are of type simple_cluster. New clusters are returned. */ + static vec<cluster *> find_bit_tests (vec<cluster *> &clusters); + /* Return true when RANGE of case values with UNIQ labels can build a bit test. */ static bool can_be_handled (unsigned HOST_WIDE_INT range, unsigned uniq); |