From patchwork Sat Dec 24 09:52:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Sokolov X-Patchwork-Id: 133155 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 89071B6FAC for ; Sat, 24 Dec 2011 20:53:15 +1100 (EST) Received: (qmail 29608 invoked by alias); 24 Dec 2011 09:53:13 -0000 Received: (qmail 29599 invoked by uid 22791); 24 Dec 2011 09:53:12 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from contrabass.post.ru (HELO contrabass.corbina.net) (85.21.78.5) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 24 Dec 2011 09:52:57 +0000 Received: from corbina.ru (violin.corbina.net [195.14.50.30]) by contrabass.corbina.net (Postfix) with ESMTP id 6DBCDC943B; Sat, 24 Dec 2011 13:52:55 +0400 (MSK) Received: from [89.178.154.120] (account aesok@post.ru HELO [192.168.1.102]) by fe1-mc.corbina.ru (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 59513306; Sat, 24 Dec 2011 13:52:55 +0400 Message-ID: <4EF5A0F6.9020002@post.ru> Date: Sat, 24 Dec 2011 13:52:54 +0400 From: post User-Agent: Mozilla/5.0 (Windows NT 6.0; WOW64; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: Jie Zhang CC: gcc-patches , bernds@codesourcery.com Subject: Re: [BFIN] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST References: <11810052402.20111223225551@post.ru> In-Reply-To: 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 Hi. > Hi Anatoly, > > I cannot apply your patch to a lean tree. I tried to save your email > as a text file, copy from thunderbird, copy from gmail, copy from the > mailing list archive. But neither works. > > Regards, > Jie You can use a patch now? Anatoly. Index: gcc/config/bfin/bfin-protos.h =================================================================== --- gcc/config/bfin/bfin-protos.h (revision 182658) +++ gcc/config/bfin/bfin-protos.h (working copy) @@ -85,9 +85,6 @@ extern bool bfin_longcall_p (rtx, int); extern bool bfin_dsp_memref_p (rtx); extern bool bfin_expand_movmem (rtx, rtx, rtx, rtx); -extern int bfin_register_move_cost (enum machine_mode, enum reg_class, - enum reg_class); -extern int bfin_memory_move_cost (enum machine_mode, enum reg_class, int in); extern enum reg_class secondary_input_reload_class (enum reg_class, enum machine_mode, rtx); Index: gcc/config/bfin/bfin.c =================================================================== --- gcc/config/bfin/bfin.c (revision 182658) +++ gcc/config/bfin/bfin.c (working copy) @@ -2149,12 +2149,11 @@ bfin_vector_mode_supported_p (enum machi return mode == V2HImode; } -/* Return the cost of moving data from a register in class CLASS1 to - one in class CLASS2. A cost of 2 is the default. */ +/* Worker function for TARGET_REGISTER_MOVE_COST. */ -int +static int bfin_register_move_cost (enum machine_mode mode, - enum reg_class class1, enum reg_class class2) + reg_class_t class1, reg_class_t class2) { /* These need secondary reloads, so they're more expensive. */ if ((class1 == CCREGS && !reg_class_subset_p (class2, DREGS)) @@ -2177,18 +2176,16 @@ bfin_register_move_cost (enum machine_mo return 2; } -/* Return the cost of moving data of mode M between a - register and memory. A value of 2 is the default; this cost is - relative to those in `REGISTER_MOVE_COST'. +/* Worker function for TARGET_MEMORY_MOVE_COST. ??? In theory L1 memory has single-cycle latency. We should add a switch that tells the compiler whether we expect to use only L1 memory for the program; it'll make the costs more accurate. */ -int +static int bfin_memory_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED, - enum reg_class rclass, - int in ATTRIBUTE_UNUSED) + reg_class_t rclass, + bool in ATTRIBUTE_UNUSED) { /* Make memory accesses slightly more expensive than any register-register move. Also, penalize non-DP registers, since they need secondary @@ -5703,6 +5700,12 @@ bfin_conditional_register_usage (void) #undef TARGET_ADDRESS_COST #define TARGET_ADDRESS_COST bfin_address_cost +#undef TARGET_REGISTER_MOVE_COST +#define TARGET_REGISTER_MOVE_COST bfin_register_move_cost + +#undef TARGET_MEMORY_MOVE_COST +#define TARGET_MEMORY_MOVE_COST bfin_memory_move_cost + #undef TARGET_ASM_INTEGER #define TARGET_ASM_INTEGER bfin_assemble_integer Index: gcc/config/bfin/bfin.h =================================================================== --- gcc/config/bfin/bfin.h (revision 182658) +++ gcc/config/bfin/bfin.h (working copy) @@ -975,29 +975,6 @@ typedef struct { /* Do not put function addr into constant pool */ #define NO_FUNCTION_CSE 1 -/* A C expression for the cost of moving data from a register in class FROM to - one in class TO. The classes are expressed using the enumeration values - such as `GENERAL_REGS'. A value of 2 is the default; other values are - interpreted relative to that. - - It is not required that the cost always equal 2 when FROM is the same as TO; - on some machines it is expensive to move between registers if they are not - general registers. */ - -#define REGISTER_MOVE_COST(MODE, CLASS1, CLASS2) \ - bfin_register_move_cost ((MODE), (CLASS1), (CLASS2)) - -/* A C expression for the cost of moving data of mode M between a - register and memory. A value of 2 is the default; this cost is - relative to those in `REGISTER_MOVE_COST'. - - If moving between registers and memory is more expensive than - between two registers, you should define this macro to express the - relative cost. */ - -#define MEMORY_MOVE_COST(MODE, CLASS, IN) \ - bfin_memory_move_cost ((MODE), (CLASS), (IN)) - /* Specify the machine mode that this machine uses for the index in the tablejump instruction. */ #define CASE_VECTOR_MODE SImode