From 5f892aa09229fb2b545b03002266f89bd653d39f Mon Sep 17 00:00:00 2001 From: Georg-Johann Lay Date: Tue, 8 Mar 2011 18:31:08 +0000 Subject: [PATCH] avr.h (REGISTER_MOVE_COST, [...]): Remove. * config/avr/avr.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove. * config/avr/avr.c (TARGET_REGISTER_MOVE_COST, TARGET_MEMORY_MOVE_COST): Define. (avr_register_move_cost, avr_memory_move_cost): New Functions. From-SVN: r170788 --- gcc/ChangeLog | 7 +++++++ gcc/config/avr/avr.c | 32 ++++++++++++++++++++++++++++++++ gcc/config/avr/avr.h | 9 --------- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5e14896efa0..6b1a72048c4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-03-08 Georg-Johann Lay + + * config/avr/avr.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove. + * config/avr/avr.c (TARGET_REGISTER_MOVE_COST, + TARGET_MEMORY_MOVE_COST): Define. + (avr_register_move_cost, avr_memory_move_cost): New Functions. + 2011-03-08 Jakub Jelinek PR debug/47881 diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 465de46225a..92cc7b65ba5 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -82,6 +82,8 @@ static unsigned int avr_section_type_flags (tree, const char *, int); static void avr_reorg (void); static void avr_asm_out_ctor (rtx, int); static void avr_asm_out_dtor (rtx, int); +static int avr_register_move_cost (enum machine_mode, reg_class_t, reg_class_t); +static int avr_memory_move_cost (enum machine_mode, reg_class_t, bool); static int avr_operand_rtx_cost (rtx, enum machine_mode, enum rtx_code, bool); static bool avr_rtx_costs (rtx, int, int, int *, bool); static int avr_address_cost (rtx, bool); @@ -174,6 +176,10 @@ static const struct default_options avr_option_optimization_table[] = #define TARGET_INSERT_ATTRIBUTES avr_insert_attributes #undef TARGET_SECTION_TYPE_FLAGS #define TARGET_SECTION_TYPE_FLAGS avr_section_type_flags +#undef TARGET_REGISTER_MOVE_COST +#define TARGET_REGISTER_MOVE_COST avr_register_move_cost +#undef TARGET_MEMORY_MOVE_COST +#define TARGET_MEMORY_MOVE_COST avr_memory_move_cost #undef TARGET_RTX_COSTS #define TARGET_RTX_COSTS avr_rtx_costs #undef TARGET_ADDRESS_COST @@ -5132,6 +5138,32 @@ order_regs_for_local_alloc (void) } +/* Implement `TARGET_REGISTER_MOVE_COST' */ + +static int +avr_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED, + reg_class_t from, reg_class_t to) +{ + return (from == STACK_REG ? 6 + : to == STACK_REG ? 12 + : 2); +} + + +/* Implement `TARGET_MEMORY_MOVE_COST' */ + +static int +avr_memory_move_cost (enum machine_mode mode, reg_class_t rclass ATTRIBUTE_UNUSED, + bool in ATTRIBUTE_UNUSED) +{ + return (mode == QImode ? 2 + : mode == HImode ? 4 + : mode == SImode ? 8 + : mode == SFmode ? 8 + : 16); +} + + /* Mutually recursive subroutine of avr_rtx_cost for calculating the cost of an RTX operand given its context. X is the rtx of the operand, MODE is its mode, and OUTER is the rtx_code of this diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 9a7107820fa..b52cf170cbc 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -447,15 +447,6 @@ do { \ #define LEGITIMATE_CONSTANT_P(X) 1 -#define REGISTER_MOVE_COST(MODE, FROM, TO) ((FROM) == STACK_REG ? 6 \ - : (TO) == STACK_REG ? 12 \ - : 2) - -#define MEMORY_MOVE_COST(MODE,CLASS,IN) ((MODE)==QImode ? 2 : \ - (MODE)==HImode ? 4 : \ - (MODE)==SImode ? 8 : \ - (MODE)==SFmode ? 8 : 16) - #define BRANCH_COST(speed_p, predictable_p) 0 #define SLOW_BYTE_ACCESS 0 -- 2.30.2