summaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authormeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-05 17:45:38 +0000
committermeissner <meissner@138bc75d-0d04-0410-961f-82ee72b054a4>2011-07-05 17:45:38 +0000
commit7e0c8808c5db75b74b90605776ba2b8bfc098483 (patch)
tree095ec451919656cb15be5b1220e74f1a6d565dc4 /gcc/stmt.c
parent58fdaa6da29a1d21502de2fd1d58b824d4a0d592 (diff)
downloadgcc-7e0c8808c5db75b74b90605776ba2b8bfc098483.tar.gz
Add --param case-values-threshold
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175878 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 1a9f9e505da..38e1e285234 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see
#include "alloc-pool.h"
#include "pretty-print.h"
#include "bitmap.h"
+#include "params.h"
/* Functions and data structures for expanding case statements. */
@@ -2270,6 +2271,20 @@ expand_switch_using_bit_tests_p (tree index_expr, tree range,
|| (uniq == 3 && count >= 6)));
}
+/* Return the smallest number of different values for which it is best to use a
+ jump-table instead of a tree of conditional branches. */
+
+static unsigned int
+case_values_threshold (void)
+{
+ unsigned int threshold = PARAM_VALUE (PARAM_CASE_VALUES_THRESHOLD);
+
+ if (threshold == 0)
+ threshold = targetm.case_values_threshold ();
+
+ return threshold;
+}
+
/* Terminate a case (Pascal/Ada) or switch (C) statement
in which ORIG_INDEX is the expression to be tested.
If ORIG_TYPE is not NULL, it is the original ORIG_INDEX
@@ -2424,7 +2439,7 @@ expand_case (gimple stmt)
If the switch-index is a constant, do it this way
because we can optimize it. */
- else if (count < targetm.case_values_threshold ()
+ else if (count < case_values_threshold ()
|| compare_tree_int (range,
(optimize_insn_for_size_p () ? 3 : 10) * count) > 0
/* RANGE may be signed, and really large ranges will show up