From 4223ff5f252b650b7e799d7e919bbc1796901aed Mon Sep 17 00:00:00 2001
From: Anatoly Sokolov <aesok@post.ru>
Date: Wed, 1 Apr 2009 09:57:14 +0400
Subject: [PATCH] avr.h (avr_case_values_threshold): Remove declaration.

	* config/avr/avr.h (avr_case_values_threshold): Remove declaration.
	(CASE_VALUES_THRESHOLD): Redefine.
	* config/avr/avr.c (avr_override_options): Remove initialization of
	avr_case_values_threshold variable.
	(avr_case_values_threshold): Remove variable. Add new function.
	* config/avr/avr-protos.h (avr_case_values_threshold): Declare.
	* config/avr/avr.opt (mno-tablejump): Remove option.
	* doc/invoke.texi (AVR Options): Remove -mno-tablejump.

From-SVN: r145389
---
 gcc/ChangeLog               | 11 +++++++++++
 gcc/config/avr/avr-protos.h |  1 +
 gcc/config/avr/avr.c        | 12 +++++++-----
 gcc/config/avr/avr.h        |  4 +---
 gcc/config/avr/avr.opt      |  4 ----
 gcc/doc/invoke.texi         |  6 +-----
 6 files changed, 21 insertions(+), 17 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 67439f6e7a3a..b767290676b8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2009-04-01  Anatoly Sokolov  <aesok@post.ru>
+
+	* config/avr/avr.h (avr_case_values_threshold): Remove declaration.
+	(CASE_VALUES_THRESHOLD): Redefine.
+	* config/avr/avr.c (avr_override_options): Remove initialization of
+	avr_case_values_threshold variable.
+	(avr_case_values_threshold): Remove variable. Add new function.
+	* config/avr/avr-protos.h (avr_case_values_threshold): Declare.
+	* config/avr/avr.opt (mno-tablejump): Remove option.
+	* doc/invoke.texi (AVR Options): Remove -mno-tablejump.
+
 2009-04-01  DJ Delorie  <dj@redhat.com>
 
 	* varasm.c (default_function_rodata_section): Don't assume
diff --git a/gcc/config/avr/avr-protos.h b/gcc/config/avr/avr-protos.h
index 2df4a16d1cf9..cb936efb6fdf 100644
--- a/gcc/config/avr/avr-protos.h
+++ b/gcc/config/avr/avr-protos.h
@@ -39,6 +39,7 @@ extern int avr_simple_epilogue (void);
 extern void gas_output_limited_string (FILE *file, const char *str);
 extern void gas_output_ascii (FILE *file, const char *str, size_t length);
 extern int avr_hard_regno_rename_ok (unsigned int, unsigned int);
+extern unsigned int avr_case_values_threshold (void);
 
 #ifdef TREE_CODE
 extern void asm_output_external (FILE *file, tree decl, char *name);
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 82a9742392ce..e868a97bed44 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -308,7 +308,6 @@ static const struct mcu_type_s avr_mcu_types[] = {
   { NULL,           ARCH_UNKNOWN, NULL }
 };
 
-int avr_case_values_threshold = 30000;
 
 /* Initialize the GCC target structure.  */
 #undef TARGET_ASM_ALIGNED_HI_OP
@@ -388,10 +387,6 @@ avr_override_options (void)
   avr_current_arch = &avr_arch_types[t->arch];
   avr_extra_arch_macro = t->macro;
 
-  if (optimize && !TARGET_NO_TABLEJUMP)
-    avr_case_values_threshold = 
-      (!AVR_HAVE_JMP_CALL || TARGET_CALL_PROLOGUES) ? 8 : 17;
-
   tmp_reg_rtx  = gen_rtx_REG (QImode, TMP_REGNO);
   zero_reg_rtx = gen_rtx_REG (QImode, ZERO_REGNO);
 
@@ -6114,4 +6109,11 @@ avr_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
     return false;
 }
 
+/* Worker function for CASE_VALUES_THRESHOLD.  */
+
+unsigned int avr_case_values_threshold (void)
+{
+  return (!AVR_HAVE_JMP_CALL || TARGET_CALL_PROLOGUES) ? 8 : 17;
+}
+
 #include "gt-avr.h"
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index 54c607a0e046..f09e8ecaa590 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -734,9 +734,7 @@ fprintf (STREAM, "\t.skip %lu,0\n", (unsigned long)(N))
 
 #define CASE_VECTOR_MODE HImode
 
-extern int avr_case_values_threshold;
-
-#define CASE_VALUES_THRESHOLD avr_case_values_threshold
+#define CASE_VALUES_THRESHOLD avr_case_values_threshold ()
 
 #undef WORD_REGISTER_OPERATIONS
 
diff --git a/gcc/config/avr/avr.opt b/gcc/config/avr/avr.opt
index 51789ec5f16a..f94d6a3c2ac8 100644
--- a/gcc/config/avr/avr.opt
+++ b/gcc/config/avr/avr.opt
@@ -37,10 +37,6 @@ mno-interrupts
 Target Report RejectNegative Mask(NO_INTERRUPTS)
 Change the stack pointer without disabling interrupts
 
-mno-tablejump
-Target Report RejectNegative Mask(NO_TABLEJUMP)
-Do not generate tablejump insns
-
 morder1
 Target Report Undocumented Mask(ORDER_1)
 
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 131633db1b7c..52fd70d1ad96 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -457,7 +457,7 @@ Objective-C and Objective-C++ Dialects}.
 
 @emph{AVR Options}
 @gccoptlist{-mmcu=@var{mcu}  -msize  -minit-stack=@var{n}  -mno-interrupts @gol
--mcall-prologues  -mno-tablejump  -mtiny-stack  -mint8}
+-mcall-prologues  -mtiny-stack  -mint8}
 
 @emph{Blackfin Options}
 @gccoptlist{-mcpu=@var{cpu}@r{[}-@var{sirevision}@r{]} @gol
@@ -9313,10 +9313,6 @@ Code size will be smaller.
 Functions prologues/epilogues expanded as call to appropriate
 subroutines.  Code size will be smaller.
 
-@item -mno-tablejump
-@opindex mno-tablejump
-Do not generate tablejump insns which sometimes increase code size.
-
 @item -mtiny-stack
 @opindex mtiny-stack
 Change only the low 8 bits of the stack pointer.
-- 
GitLab