Commit 1aabb71d by Martin Liska Committed by Martin Liska

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
parent df7c7974
2018-06-28 Martin Liska <mliska@suse.cz> 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): * tree-switch-conversion.c (jump_table_cluster::find_jump_tables):
Add new checking assert to catch invalid state. Add new checking assert to catch invalid state.
(jump_table_cluster::can_be_handled): Handle single case (jump_table_cluster::can_be_handled): Handle single case
......
...@@ -1180,7 +1180,8 @@ jump_table_cluster::can_be_handled (const vec<cluster *> &clusters, ...@@ -1180,7 +1180,8 @@ jump_table_cluster::can_be_handled (const vec<cluster *> &clusters,
if (start == end) if (start == end)
return true; 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 (), unsigned HOST_WIDE_INT range = get_range (clusters[start]->get_low (),
clusters[end]->get_high ()); clusters[end]->get_high ());
/* Check overflow. */ /* Check overflow. */
......
...@@ -257,6 +257,12 @@ struct jump_table_cluster: public group_cluster ...@@ -257,6 +257,12 @@ struct jump_table_cluster: public group_cluster
/* Return whether jump table expansion is allowed. */ /* Return whether jump table expansion is allowed. */
static bool is_enabled (void); 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 /* A GIMPLE switch statement can be expanded to a short sequence of bit-wise
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment