From 107715f026335f9cf0d71d045296572f5416c919 Mon Sep 17 00:00:00 2001 From: Anatoly Sokolov Date: Mon, 2 Apr 2012 22:45:13 +0400 Subject: [PATCH] arm.h (PREFERRED_RELOAD_CLASS): Remove. * config/arm/arm.h (PREFERRED_RELOAD_CLASS): Remove. * config/arm/arm.c (TARGET_PREFERRED_RELOAD_CLASS): Define. (arm_preferred_reload_class): New function. From-SVN: r186092 --- gcc/ChangeLog | 6 ++++++ gcc/config/arm/arm.c | 28 ++++++++++++++++++++++++++++ gcc/config/arm/arm.h | 10 ---------- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2d4fb1d..8a341dd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-04-02 Anatoly Sokolov + + * config/arm/arm.h (PREFERRED_RELOAD_CLASS): Remove. + * config/arm/arm.c (TARGET_PREFERRED_RELOAD_CLASS): Define. + (arm_preferred_reload_class): New function. + 2012-04-02 Richard Guenther PR tree-optimization/52756 diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index 9af66dd..5522fc1 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -82,6 +82,7 @@ static int arm_legitimate_index_p (enum machine_mode, rtx, RTX_CODE, int); static int thumb2_legitimate_index_p (enum machine_mode, rtx, int); static int thumb1_base_register_rtx_p (rtx, enum machine_mode, int); static rtx arm_legitimize_address (rtx, rtx, enum machine_mode); +static reg_class_t arm_preferred_reload_class (rtx, reg_class_t); static rtx thumb_legitimize_address (rtx, rtx, enum machine_mode); inline static int thumb1_index_register_rtx_p (rtx, int); static bool arm_legitimate_address_p (enum machine_mode, rtx, bool); @@ -576,6 +577,9 @@ static const struct attribute_spec arm_attribute_table[] = #undef TARGET_LEGITIMATE_ADDRESS_P #define TARGET_LEGITIMATE_ADDRESS_P arm_legitimate_address_p +#undef TARGET_PREFERRED_RELOAD_CLASS +#define TARGET_PREFERRED_RELOAD_CLASS arm_preferred_reload_class + #undef TARGET_INVALID_PARAMETER_TYPE #define TARGET_INVALID_PARAMETER_TYPE arm_invalid_parameter_type @@ -6226,6 +6230,30 @@ arm_legitimate_address_p (enum machine_mode mode, rtx x, bool strict_p) return thumb1_legitimate_address_p (mode, x, strict_p); } +/* Worker function for TARGET_PREFERRED_RELOAD_CLASS. + + Given an rtx X being reloaded into a reg required to be + in class CLASS, return the class of reg to actually use. + In general this is just CLASS, but for the Thumb core registers and + immediate constants we prefer a LO_REGS class or a subset. */ + +static reg_class_t +arm_preferred_reload_class (rtx x ATTRIBUTE_UNUSED, reg_class_t rclass) +{ + if (TARGET_32BIT) + return rclass; + else + { + if (rclass == GENERAL_REGS + || rclass == HI_REGS + || rclass == NO_REGS + || rclass == STACK_REG) + return LO_REGS; + else + return rclass; + } +} + /* Build the SYMBOL_REF for __tls_get_addr. */ static GTY(()) rtx tls_get_addr_libfunc; diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 443d2ed..c6b4cc0 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1151,16 +1151,6 @@ enum reg_class #define TARGET_SMALL_REGISTER_CLASSES_FOR_MODE_P \ arm_small_register_classes_for_mode_p -/* Given an rtx X being reloaded into a reg required to be - in class CLASS, return the class of reg to actually use. - In general this is just CLASS, but for the Thumb core registers and - immediate constants we prefer a LO_REGS class or a subset. */ -#define PREFERRED_RELOAD_CLASS(X, CLASS) \ - (TARGET_32BIT ? (CLASS) : \ - ((CLASS) == GENERAL_REGS || (CLASS) == HI_REGS \ - || (CLASS) == NO_REGS || (CLASS) == STACK_REG \ - ? LO_REGS : (CLASS))) - /* Must leave BASE_REGS reloads alone */ #define THUMB_SECONDARY_INPUT_RELOAD_CLASS(CLASS, MODE, X) \ ((CLASS) != LO_REGS && (CLASS) != BASE_REGS \ -- 2.7.4