|
|
Hi.
> On 10/07/2009 11:35 AM, Anatoly Sokolov wrote:
>> Hello.
>>
>> This patch change default_libcall_value function to don't use
>> LIBCALL_VALUE
>> macro if it is not defined. This will allow consistently, target by target,
>> move to use TARGET_LIBCALL_VALUE instead of LIBCALL_VALUE.
> Did you want to return NULL,
No, I don't want to return NULL. Use 'return NULL_RTX' make code more
type-safe and self documented.
> or should that be gcc_unreachable?
Yes, I agree. Doing so, we specify that TARGET_LIBCALL_VALUE target hook is
mandatory on all machines.
Additional, I suggest to use gcc_unreachable in default_function_value if
FUNCTION_VALUE macro 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.
Index: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi (revision 152618)
+++ gcc/doc/tm.texi (working copy)
@@ -4394,7 +4394,7 @@
@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.
Index: gcc/targhooks.c
===================================================================
--- gcc/targhooks.c (revision 152618)
+++ gcc/targhooks.c (working copy)
@@ -603,14 +603,19 @@
#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
Index: gcc/targhooks.h
===================================================================
--- gcc/targhooks.h (revision 152618)
+++ gcc/targhooks.h (working copy)
@@ -98,7 +98,7 @@
(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);
Index: gcc/target.h
===================================================================
--- gcc/target.h (revision 152618)
+++ gcc/target.h (working copy)
@@ -908,7 +908,7 @@
/* 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. */
Index: gcc/config/arm/arm.c
===================================================================
--- gcc/config/arm/arm.c (revision 152618)
+++ gcc/config/arm/arm.c (working copy)
@@ -133,7 +133,7 @@
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 @@
}
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 @@
}
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)
Anatoly.
|
|