From 63d12187eec83df16ab703a4a5de5ee6daaf106a Mon Sep 17 00:00:00 2001 From: aesok Date: Sat, 3 Dec 2011 09:03:13 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181965 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 10 +++++++ gcc/config/arm/arm-protos.h | 1 - gcc/config/arm/arm.c | 66 +++++++++++++++++++++++++++++++++++++++++---- gcc/config/arm/arm.h | 26 ------------------ 4 files changed, 71 insertions(+), 32 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 05706ab6691..3b4bf139961 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2011-12-03 Anatoly Sokolov + + * 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 PR target/51387 diff --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 23a29c6639b..9907ea55d0e 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -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); #endif extern int arm_apply_result_size (void); -extern rtx aapcs_libcall_value (enum machine_mode); #endif /* RTX_CODE */ diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index a57494c4c3e..eaac1cfba89 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -147,8 +147,9 @@ 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_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 void arm_function_arg_advance (cumulative_args_t, enum machine_mode, 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 @@ static const struct attribute_spec arm_attribute_table[] = #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 @@ -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 @@ -3682,7 +3687,32 @@ arm_libcall_uses_aapcs_base (const_rtx libcall) 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 @@ -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 @@ -4513,7 +4569,7 @@ aapcs_allocate_return_reg (enum machine_mode mode, const_tree type, 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) diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 85e2b9971c4..8a9ed1f510b 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1348,32 +1348,6 @@ do { \ /* 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() -- 2.11.0