diff options
author | Martin Liska <mliska@suse.cz> | 2018-06-28 09:15:55 +0200 |
---|---|---|
committer | Martin Liska <marxin@gcc.gnu.org> | 2018-06-28 07:15:55 +0000 |
commit | 1aabb71d1331430965794be43f01d0e42e1351e3 (patch) | |
tree | 8dca8402123e02905bfcf087e6c8f2397112c5be /gcc | |
parent | df7c79742af79bc2873ca28a8b3037a088444ca7 (diff) | |
download | gcc-1aabb71d1331430965794be43f01d0e42e1351e3.zip gcc-1aabb71d1331430965794be43f01d0e42e1351e3.tar.gz gcc-1aabb71d1331430965794be43f01d0e42e1351e3.tar.bz2 |
Come up with jump_table ratio constants used in jump_table_cluster.
2018-06-28 Martin Liska <mliska@suse.cz>
* tree-switch-conversion.c (jump_table_cluster::can_be_handled):
Use newly introduced constants.
* tree-switch-conversion.h (struct jump_table_cluster):
Define max_ratio_for_size and max_ratio_for_speed.
From-SVN: r262212
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/tree-switch-conversion.c | 3 | ||||
-rw-r--r-- | gcc/tree-switch-conversion.h | 6 |
3 files changed, 15 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 926f8bc..8902e4a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2018-06-28 Martin Liska <mliska@suse.cz> + * tree-switch-conversion.c (jump_table_cluster::can_be_handled): + Use newly introduced constants. + * tree-switch-conversion.h (struct jump_table_cluster): + Define max_ratio_for_size and max_ratio_for_speed. + +2018-06-28 Martin Liska <mliska@suse.cz> + * tree-switch-conversion.c (jump_table_cluster::find_jump_tables): Add new checking assert to catch invalid state. (jump_table_cluster::can_be_handled): Handle single case diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c index ddd8cba..b79f2fd 100644 --- a/gcc/tree-switch-conversion.c +++ b/gcc/tree-switch-conversion.c @@ -1180,7 +1180,8 @@ jump_table_cluster::can_be_handled (const vec<cluster *> &clusters, if (start == end) return true; - unsigned HOST_WIDE_INT max_ratio = optimize_insn_for_size_p () ? 3 : 8; + unsigned HOST_WIDE_INT max_ratio + = optimize_insn_for_size_p () ? max_ratio_for_size : max_ratio_for_speed; unsigned HOST_WIDE_INT range = get_range (clusters[start]->get_low (), clusters[end]->get_high ()); /* Check overflow. */ diff --git a/gcc/tree-switch-conversion.h b/gcc/tree-switch-conversion.h index 79a1320..4beac78 100644 --- a/gcc/tree-switch-conversion.h +++ b/gcc/tree-switch-conversion.h @@ -257,6 +257,12 @@ struct jump_table_cluster: public group_cluster /* Return whether jump table expansion is allowed. */ static bool is_enabled (void); + + /* Max growth ratio for code that is optimized for size. */ + static const unsigned HOST_WIDE_INT max_ratio_for_size = 3; + + /* Max growth ratio for code that is optimized for speed. */ + static const unsigned HOST_WIDE_INT max_ratio_for_speed = 8; }; /* A GIMPLE switch statement can be expanded to a short sequence of bit-wise |