Hello. This patch removes obsolete FUNCTION_VALUE_REGNO_P macro from ARM back end in the GCC and introduces equivalent TARGET_FUNCTION_VALUE_REGNO_P target hook.
Since the LIBCALL_VALUE macro should be poisoned in the future, this patch replaces it with the arm_libcall_value_1 function. Bootstrapped and regression tested on arm-unknown-linux-gnueabi. * 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 Index: gcc/config/arm/arm.c =================================================================== --- gcc/config/arm/arm.c (revision 181476) +++ gcc/config/arm/arm.c (working copy) @@ -147,8 +147,9 @@ 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_1 (enum machine_mode); 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_output_mi_thunk (FILE *, tree, HOST_WIDE_INT, HOST_WIDE_INT, tree); @@ -184,6 +185,7 @@ static unsigned int arm_function_arg_boundary (enum machine_mode, const_tree); static rtx aapcs_allocate_return_reg (enum machine_mode, const_tree, const_tree); +static rtx aapcs_libcall_value (enum machine_mode); static int aapcs_select_return_coproc (const_tree, const_tree); #ifdef OBJECT_FORMAT_ELF @@ -383,6 +385,9 @@ #undef TARGET_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 #define TARGET_ASM_OUTPUT_MI_THUNK arm_output_mi_thunk #undef TARGET_ASM_CAN_OUTPUT_MI_THUNK @@ -3588,7 +3593,7 @@ } } - return LIBCALL_VALUE (mode); + return arm_libcall_value_1 (mode); } static int @@ -3678,7 +3683,32 @@ 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) { if (TARGET_AAPCS_BASED && arm_pcs_default != ARM_PCS_AAPCS @@ -3691,9 +3721,35 @@ } - 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 registers of an untyped call. */ int @@ -4509,7 +4565,7 @@ return gen_rtx_REG (mode, R0_REGNUM); } -rtx +static rtx aapcs_libcall_value (enum machine_mode mode) { if (BYTES_BIG_ENDIAN && ALL_FIXED_POINT_MODE_P (mode) Index: gcc/config/arm/arm.h =================================================================== --- gcc/config/arm/arm.h (revision 181476) +++ gcc/config/arm/arm.h (working copy) @@ -1348,32 +1348,6 @@ /* Offset of first parameter from the argument pointer register value. */ #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 registers. */ #define APPLY_RESULT_SIZE arm_apply_result_size() Index: gcc/config/arm/arm-protos.h =================================================================== --- gcc/config/arm/arm-protos.h (revision 181476) +++ gcc/config/arm/arm-protos.h (working copy) @@ -168,7 +168,6 @@ extern bool arm_pad_reg_upward (enum machine_mode, tree, int); #endif extern int arm_apply_result_size (void); -extern rtx aapcs_libcall_value (enum machine_mode); #endif /* RTX_CODE */ Anatoly.