avr.c (avr_case_values_threshold): Return 7.
authorGeorg-Johann Lay <avr@gjlay.de>
Fri, 8 Jun 2012 18:32:25 +0000 (18:32 +0000)
committerGeorg-Johann Lay <gjl@gcc.gnu.org>
Fri, 8 Jun 2012 18:32:25 +0000 (18:32 +0000)
* config/avr/avr.c (avr_case_values_threshold): Return 7.

From-SVN: r188336

gcc/ChangeLog
gcc/config/avr/avr.c

index 19cbadefd042b2586ec60e4cac31ac2002e17920..1026c9002cc8919f2273b81e20b5ba9c1b7e68df 100644 (file)
@@ -1,3 +1,7 @@
+2012-06-08  Georg-Johann Lay  <avr@gjlay.de>
+
+       * config/avr/avr.c (avr_case_values_threshold): Return 7.
+
 2012-06-07  Andreas Schwab  <schwab@linux-m68k.org>
 
        * genhooks.c (main): Set progname.
index 208f650c9afcdd2dc614edd35534904d97e765cd..cd1a4af36b5c3708bc8444eb8d5c41408e89799a 100644 (file)
@@ -9419,12 +9419,20 @@ avr_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
     return false;
 }
 
-/* Worker function for CASE_VALUES_THRESHOLD.  */
+
+/* Implement `CASE_VALUES_THRESHOLD'.  */
+/* Supply the default for --param case-values-threshold=0  */
 
 static unsigned int
 avr_case_values_threshold (void)
 {
-  return (!AVR_HAVE_JMP_CALL || TARGET_CALL_PROLOGUES) ? 8 : 17;
+  /* The exact break-even point between a jump table and an if-else tree
+     depends on several factors not available here like, e.g. if 8-bit
+     comparisons can be used in the if-else tree or not, on the
+     range of the case values, if the case value can be reused, on the
+     register allocation, etc.  '7' appears to be a good choice.  */
+     
+  return 7;
 }