arm.h (LIBCALL_VALUE, [...]): Remove.

* config/arm/arm.h (LIBCALL_VALUE, FUNCTION_VALUE_REGNO_P): Remove.
	* config/arm/arm-protos.h (aapcs_libcall_value): Remove.
	* config/arm/arm.c (TARGET_FUNCTION_VALUE_REGNO_P): Define.
	(arm_libcall_value_1, arm_function_value_regno_p): New function.
	(arm_function_value, arm_libcall_value): Use arm_libcall_value_1.
	(aapcs_libcall_value): Make static.
	(arm_libcall_value): Add static qualifier.

From-SVN: r181965
This commit is contained in:
Anatoly Sokolov 2011-12-03 13:03:13 +04:00 committed by Anatoly Sokolov
parent 2fd401c8f1
commit df1204ec90
4 changed files with 71 additions and 32 deletions

View File

@ -1,3 +1,13 @@
2011-12-03 Anatoly Sokolov <aesok@post.ru>
* config/arm/arm.h (LIBCALL_VALUE, FUNCTION_VALUE_REGNO_P): Remove.
* config/arm/arm-protos.h (aapcs_libcall_value): Remove.
* config/arm/arm.c (TARGET_FUNCTION_VALUE_REGNO_P): Define.
(arm_libcall_value_1, arm_function_value_regno_p): New function.
(arm_function_value, arm_libcall_value): Use arm_libcall_value_1.
(aapcs_libcall_value): Make static.
(arm_libcall_value): Add static qualifier.
2011-12-02 Jakub Jelinek <jakub@redhat.com> 2011-12-02 Jakub Jelinek <jakub@redhat.com>
PR target/51387 PR target/51387

View File

@ -168,7 +168,6 @@ extern bool arm_pad_arg_upward (enum machine_mode, const_tree);
extern bool arm_pad_reg_upward (enum machine_mode, tree, int); extern bool arm_pad_reg_upward (enum machine_mode, tree, int);
#endif #endif
extern int arm_apply_result_size (void); extern int arm_apply_result_size (void);
extern rtx aapcs_libcall_value (enum machine_mode);
#endif /* RTX_CODE */ #endif /* RTX_CODE */

View File

@ -147,8 +147,9 @@ static enum machine_mode arm_promote_function_mode (const_tree,
const_tree, int); const_tree, int);
static bool arm_return_in_memory (const_tree, const_tree); static bool arm_return_in_memory (const_tree, const_tree);
static rtx arm_function_value (const_tree, const_tree, bool); static rtx arm_function_value (const_tree, const_tree, bool);
static rtx arm_libcall_value_1 (enum machine_mode);
static rtx arm_libcall_value (enum machine_mode, const_rtx); static rtx arm_libcall_value (enum machine_mode, const_rtx);
static bool arm_function_value_regno_p (const unsigned int);
static void arm_internal_label (FILE *, const char *, unsigned long); static void arm_internal_label (FILE *, const char *, unsigned long);
static void arm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, static void arm_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT,
tree); tree);
@ -184,6 +185,7 @@ static void arm_function_arg_advance (cumulative_args_t, enum machine_mode,
static unsigned int arm_function_arg_boundary (enum machine_mode, const_tree); static unsigned int arm_function_arg_boundary (enum machine_mode, const_tree);
static rtx aapcs_allocate_return_reg (enum machine_mode, const_tree, static rtx aapcs_allocate_return_reg (enum machine_mode, const_tree,
const_tree); const_tree);
static rtx aapcs_libcall_value (enum machine_mode);
static int aapcs_select_return_coproc (const_tree, const_tree); static int aapcs_select_return_coproc (const_tree, const_tree);
#ifdef OBJECT_FORMAT_ELF #ifdef OBJECT_FORMAT_ELF
@ -383,6 +385,9 @@ static const struct attribute_spec arm_attribute_table[] =
#undef TARGET_LIBCALL_VALUE #undef TARGET_LIBCALL_VALUE
#define TARGET_LIBCALL_VALUE arm_libcall_value #define TARGET_LIBCALL_VALUE arm_libcall_value
#undef TARGET_FUNCTION_VALUE_REGNO_P
#define TARGET_FUNCTION_VALUE_REGNO_P arm_function_value_regno_p
#undef TARGET_ASM_OUTPUT_MI_THUNK #undef TARGET_ASM_OUTPUT_MI_THUNK
#define TARGET_ASM_OUTPUT_MI_THUNK arm_output_mi_thunk #define TARGET_ASM_OUTPUT_MI_THUNK arm_output_mi_thunk
#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
@ -3592,7 +3597,7 @@ arm_function_value(const_tree type, const_tree func,
} }
} }
return LIBCALL_VALUE (mode); return arm_libcall_value_1 (mode);
} }
static int static int
@ -3682,7 +3687,32 @@ arm_libcall_uses_aapcs_base (const_rtx libcall)
return libcall && htab_find (libcall_htab, libcall) != NULL; return libcall && htab_find (libcall_htab, libcall) != NULL;
} }
rtx static rtx
arm_libcall_value_1 (enum machine_mode mode)
{
if (TARGET_AAPCS_BASED)
return aapcs_libcall_value (mode);
else if (TARGET_32BIT
&& TARGET_HARD_FLOAT_ABI
&& TARGET_FPA
&& GET_MODE_CLASS (mode) == MODE_FLOAT)
return gen_rtx_REG (mode, FIRST_FPA_REGNUM);
else if (TARGET_32BIT
&& TARGET_HARD_FLOAT_ABI
&& TARGET_MAVERICK
&& GET_MODE_CLASS (mode) == MODE_FLOAT)
return gen_rtx_REG (mode, FIRST_CIRRUS_FP_REGNUM);
else if (TARGET_IWMMXT_ABI
&& arm_vector_mode_supported_p (mode))
return gen_rtx_REG (mode, FIRST_IWMMXT_REGNUM);
else
return gen_rtx_REG (mode, ARG_REGISTER (1));
}
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
static rtx
arm_libcall_value (enum machine_mode mode, const_rtx libcall) arm_libcall_value (enum machine_mode mode, const_rtx libcall)
{ {
if (TARGET_AAPCS_BASED && arm_pcs_default != ARM_PCS_AAPCS if (TARGET_AAPCS_BASED && arm_pcs_default != ARM_PCS_AAPCS
@ -3695,7 +3725,33 @@ arm_libcall_value (enum machine_mode mode, const_rtx libcall)
} }
return LIBCALL_VALUE (mode); return arm_libcall_value_1 (mode);
}
/* Implement TARGET_FUNCTION_VALUE_REGNO_P. */
static bool
arm_function_value_regno_p (const unsigned int regno)
{
if (regno == ARG_REGISTER (1)
|| (TARGET_32BIT
&& TARGET_AAPCS_BASED
&& TARGET_VFP
&& TARGET_HARD_FLOAT
&& regno == FIRST_VFP_REGNUM)
|| (TARGET_32BIT
&& TARGET_HARD_FLOAT_ABI
&& TARGET_MAVERICK
&& regno == FIRST_CIRRUS_FP_REGNUM)
|| (TARGET_IWMMXT_ABI
&& regno == FIRST_IWMMXT_REGNUM)
|| (TARGET_32BIT
&& TARGET_HARD_FLOAT_ABI
&& TARGET_FPA
&& regno == FIRST_FPA_REGNUM))
return true;
return false;
} }
/* Determine the amount of memory needed to store the possible return /* Determine the amount of memory needed to store the possible return
@ -4513,7 +4569,7 @@ aapcs_allocate_return_reg (enum machine_mode mode, const_tree type,
return gen_rtx_REG (mode, R0_REGNUM); return gen_rtx_REG (mode, R0_REGNUM);
} }
rtx static rtx
aapcs_libcall_value (enum machine_mode mode) aapcs_libcall_value (enum machine_mode mode)
{ {
if (BYTES_BIG_ENDIAN && ALL_FIXED_POINT_MODE_P (mode) if (BYTES_BIG_ENDIAN && ALL_FIXED_POINT_MODE_P (mode)

View File

@ -1348,32 +1348,6 @@ do { \
/* Offset of first parameter from the argument pointer register value. */ /* Offset of first parameter from the argument pointer register value. */
#define FIRST_PARM_OFFSET(FNDECL) (TARGET_ARM ? 4 : 0) #define FIRST_PARM_OFFSET(FNDECL) (TARGET_ARM ? 4 : 0)
/* Define how to find the value returned by a library function
assuming the value has mode MODE. */
#define LIBCALL_VALUE(MODE) \
(TARGET_AAPCS_BASED ? aapcs_libcall_value (MODE) \
: (TARGET_32BIT && TARGET_HARD_FLOAT_ABI && TARGET_FPA \
&& GET_MODE_CLASS (MODE) == MODE_FLOAT) \
? gen_rtx_REG (MODE, FIRST_FPA_REGNUM) \
: TARGET_32BIT && TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK \
&& GET_MODE_CLASS (MODE) == MODE_FLOAT \
? gen_rtx_REG (MODE, FIRST_CIRRUS_FP_REGNUM) \
: TARGET_IWMMXT_ABI && arm_vector_mode_supported_p (MODE) \
? gen_rtx_REG (MODE, FIRST_IWMMXT_REGNUM) \
: gen_rtx_REG (MODE, ARG_REGISTER (1)))
/* 1 if REGNO is a possible register number for a function value. */
#define FUNCTION_VALUE_REGNO_P(REGNO) \
((REGNO) == ARG_REGISTER (1) \
|| (TARGET_AAPCS_BASED && TARGET_32BIT \
&& TARGET_VFP && TARGET_HARD_FLOAT \
&& (REGNO) == FIRST_VFP_REGNUM) \
|| (TARGET_32BIT && ((REGNO) == FIRST_CIRRUS_FP_REGNUM) \
&& TARGET_HARD_FLOAT_ABI && TARGET_MAVERICK) \
|| ((REGNO) == FIRST_IWMMXT_REGNUM && TARGET_IWMMXT_ABI) \
|| (TARGET_32BIT && ((REGNO) == FIRST_FPA_REGNUM) \
&& TARGET_HARD_FLOAT_ABI && TARGET_FPA))
/* Amount of memory needed for an untyped call to save all possible return /* Amount of memory needed for an untyped call to save all possible return
registers. */ registers. */
#define APPLY_RESULT_SIZE arm_apply_result_size() #define APPLY_RESULT_SIZE arm_apply_result_size()