From patchwork Tue Mar 8 11:27:11 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 85968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id CAD90B70BA for ; Tue, 8 Mar 2011 22:27:31 +1100 (EST) Received: (qmail 10127 invoked by alias); 8 Mar 2011 11:27:29 -0000 Received: (qmail 10119 invoked by uid 22791); 8 Mar 2011 11:27:28 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mo-p00-ob.rzone.de (HELO mo-p00-ob.rzone.de) (81.169.146.160) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Mar 2011 11:27:21 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT2k715jHQaJercGObUOFkj18odoYNahU4Q== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.22] (business-188-111-022-002.static.arcor-ip.net [188.111.22.2]) by post.strato.de (cohen mo51) (RZmta 25.5) with ESMTPA id a062efn28B2rtw ; Tue, 8 Mar 2011 12:27:11 +0100 (MET) Message-ID: <4D76128F.1070506@gjlay.de> Date: Tue, 08 Mar 2011 12:27:11 +0100 From: Georg-Johann Lay User-Agent: Thunderbird 2.0.0.24 (X11/20100302) MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org CC: Denis Chertykov , Anatoly Sokolov , Eric Weddington Subject: [Patch, AVR] Housekeeping: Hookize REGISTER_MOVE_COST, MEMORY_MOVE_COST X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch moves deprecated REGISTER_MOVE_COST resp. MEMORY_MOVE_COST from avr.h to target hook avr_register_move_cost resp. avr_memory_move_cost in avr.c. No functionality added or removed; costs are unchanged. 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. Index: config/avr/avr.c =================================================================== --- config/avr/avr.c (revision 170704) +++ config/avr/avr.c (working copy) @@ -82,6 +82,8 @@ static unsigned int avr_section_type_fla 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_ #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 Index: config/avr/avr.h =================================================================== --- config/avr/avr.h (revision 170704) +++ config/avr/avr.h (working copy) @@ -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