From 7fc6a96bed6d0b2511f56e246c5ca0c3058616aa Mon Sep 17 00:00:00 2001
From: Anatoly Sokolov <aesok@post.ru>
Date: Sat, 17 Oct 2009 14:46:18 +0400
Subject: [PATCH] targhooks.c (default_libcall_value): Don't use LIBCALL_VALUE
 macro if not defined.

	* targhooks.c (default_libcall_value): Don't use LIBCALL_VALUE macro
	if not defined. Change type of second argument to const_rtx.
	(default_function_value): Call gcc_unreachable if FUNCTION_VALUE
	macro not defined.
	* targhooks.h (default_libcall_value): Update prototype.
	* target.h (struct gcc_target): Change type of second argument of
	libcall_value to const_rtx.
	* config/arm/arm.c (arm_libcall_value): Change type of second argument
	to const_rtx.
	(arm_libcall_uses_aapcs_base): Change type of argument to const_rtx.
	* doc/tm.texi (TARGET_LIBCALL_VALUE):  Revise documentation.

From-SVN: r152933
---
 gcc/ChangeLog        | 14 ++++++++++++++
 gcc/config/arm/arm.c |  6 +++---
 gcc/doc/tm.texi      |  2 +-
 gcc/target.h         |  2 +-
 gcc/targhooks.c      |  9 +++++++--
 gcc/targhooks.h      |  2 +-
 6 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 007d78e10c66..aed9418d4706 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,17 @@
+2009-10-17  Anatoly Sokolov  <aesok@post.ru>
+
+	* targhooks.c (default_libcall_value): Don't use LIBCALL_VALUE macro
+	if not defined. Change type of second argument to const_rtx.
+	(default_function_value): Call gcc_unreachable if FUNCTION_VALUE
+	macro not defined.
+	* targhooks.h (default_libcall_value): Update prototype.
+	* target.h (struct gcc_target): Change type of second argument of
+	libcall_value to const_rtx.
+	* config/arm/arm.c (arm_libcall_value): Change type of second argument
+	to const_rtx.
+	(arm_libcall_uses_aapcs_base): Change type of argument to const_rtx.
+	* doc/tm.texi (TARGET_LIBCALL_VALUE):  Revise documentation.
+
 2009-10-17  Jakub Jelinek  <jakub@redhat.com>
 
 	PR debug/40521
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index fb4e59fff47e..3aff8e7ff931 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -133,7 +133,7 @@ static enum machine_mode arm_promote_function_mode (const_tree,
 						    const_tree, int);
 static bool arm_return_in_memory (const_tree, const_tree);
 static rtx arm_function_value (const_tree, const_tree, bool);
-static rtx arm_libcall_value (enum machine_mode, rtx);
+static rtx arm_libcall_value (enum machine_mode, const_rtx);
 
 static void arm_internal_label (FILE *, const char *, unsigned long);
 static void arm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT,
@@ -3264,7 +3264,7 @@ add_libcall (htab_t htab, rtx libcall)
 }
 
 static bool
-arm_libcall_uses_aapcs_base (rtx libcall)
+arm_libcall_uses_aapcs_base (const_rtx libcall)
 {
   static bool init_done = false;
   static htab_t libcall_htab;
@@ -3311,7 +3311,7 @@ arm_libcall_uses_aapcs_base (rtx libcall)
 }
 
 rtx
-arm_libcall_value (enum machine_mode mode, rtx libcall)
+arm_libcall_value (enum machine_mode mode, const_rtx libcall)
 {
   if (TARGET_AAPCS_BASED && arm_pcs_default != ARM_PCS_AAPCS
       && GET_MODE_CLASS (mode) == MODE_FLOAT)
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 57e2b76fa506..805ebf2b3ab7 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -4399,7 +4399,7 @@ compiled.
 @end defmac
 
 @deftypefn {Target Hook} rtx TARGET_LIBCALL_VALUE (enum machine_mode
-@var{mode}, rtx @var{fun})
+@var{mode}, const_rtx @var{fun})
 Define this hook if the back-end needs to know the name of the libcall
 function in order to determine where the result should be returned.  
 
diff --git a/gcc/target.h b/gcc/target.h
index c65063cbfc60..2c7fa4a6aa97 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -908,7 +908,7 @@ struct gcc_target
 
     /* Return the rtx for the result of a libcall of mode MODE,
        calling the function FN_NAME.  */
-    rtx (*libcall_value) (enum machine_mode, rtx);
+    rtx (*libcall_value) (enum machine_mode, const_rtx);
 
     /* Return an rtx for the argument pointer incoming to the
        current function.  */
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index dd52da986389..8614a4ff669b 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -603,14 +603,19 @@ default_function_value (const_tree ret_type ATTRIBUTE_UNUSED,
 #ifdef FUNCTION_VALUE
   return FUNCTION_VALUE (ret_type, fn_decl_or_type);
 #else
-  return NULL_RTX;
+  gcc_unreachable ();
 #endif
 }
 
 rtx
-default_libcall_value (enum machine_mode mode, rtx fun ATTRIBUTE_UNUSED)
+default_libcall_value (enum machine_mode mode ATTRIBUTE_UNUSED,
+		       const_rtx fun ATTRIBUTE_UNUSED)
 {
+#ifdef LIBCALL_VALUE
   return LIBCALL_VALUE (mode);
+#else
+  gcc_unreachable ();
+#endif
 }
 
 rtx
diff --git a/gcc/targhooks.h b/gcc/targhooks.h
index 490d4ceeb91f..3680b9bb63fc 100644
--- a/gcc/targhooks.h
+++ b/gcc/targhooks.h
@@ -98,7 +98,7 @@ extern const char *hook_invalid_arg_for_unprototyped_fn
   (const_tree, const_tree, const_tree);
 extern bool hook_bool_const_rtx_commutative_p (const_rtx, int);
 extern rtx default_function_value (const_tree, const_tree, bool);
-extern rtx default_libcall_value (enum machine_mode, rtx);
+extern rtx default_libcall_value (enum machine_mode, const_rtx);
 extern rtx default_internal_arg_pointer (void);
 extern rtx default_static_chain (const_tree, bool);
 extern void default_trampoline_init (rtx, tree, rtx);
-- 
GitLab