From patchwork Fri Dec 23 19:08:33 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Sokolov X-Patchwork-Id: 133138 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 0299CB71DB for ; Sat, 24 Dec 2011 06:08:59 +1100 (EST) Received: (qmail 5995 invoked by alias); 23 Dec 2011 19:08:57 -0000 Received: (qmail 5986 invoked by uid 22791); 23 Dec 2011 19:08:56 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL, BAYES_00, KAM_THEBAT, 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; Fri, 23 Dec 2011 19:08:32 +0000 Received: from corbina.ru (violin.corbina.net [195.14.50.30]) by contrabass.corbina.net (Postfix) with ESMTP id 906B1C9E29; Fri, 23 Dec 2011 23:08:30 +0400 (MSK) Received: from [89.178.154.24] (account aesok@post.ru HELO Vista.beeline) by fe1-mc.corbina.ru (CommuniGate Pro SMTP 5.4.2) with ESMTPA id 59409067; Fri, 23 Dec 2011 23:08:30 +0400 Date: Fri, 23 Dec 2011 23:08:33 +0400 From: Anatoly Sokolov Message-ID: <1752689113.20111223230833@post.ru> To: gcc-patches CC: liqin.gcc@gmail.com Subject: [SCORE] Hookize REGISTER_MOVE_COST and MEMORY_MOVE_COST MIME-Version: 1.0 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. This patch removes obsolete REGISTER_MOVE_COST macro from the SCORE back end in the GCC and introduces equivalent TARGET_MEMORY_MOVE_COST target hook. The MEMORY_MOVE_COST macros is removed and default implementation of the TARGET_MEMORY_MOVE_COST target hook is used. Untested. OK to install? * config/score/score.h (REGISTER_MOVE_COST, MEMORY_MOVE_COST): Remove. * config/score/score-protos.h (score_register_move_cost): Remove. * config/score/score.c (TARGET_REGISTER_MOVE_COST): Define. (score_register_move_cost): Make static. Change arguments type from enum reg_class to reg_class_t. Anatoly. Index: gcc/config/score/score.h =================================================================== --- gcc/config/score/score.h (revision 182660) +++ gcc/config/score/score.h (working copy) @@ -601,14 +601,6 @@ typedef struct score_args #define REVERSIBLE_CC_MODE(MODE) 1 /* Describing Relative Costs of Operations */ -/* Compute extra cost of moving data between one register class and another. */ -#define REGISTER_MOVE_COST(MODE, FROM, TO) \ - score_register_move_cost (MODE, FROM, TO) - -/* Moves to and from memory are quite expensive */ -#define MEMORY_MOVE_COST(MODE, CLASS, TO_P) \ - (4 + memory_move_secondary_cost ((MODE), (CLASS), (TO_P))) - /* Try to generate sequences that don't involve branches. */ #define BRANCH_COST(speed_p, predictable_p) 2 Index: gcc/config/score/score-protos.h =================================================================== --- gcc/config/score/score-protos.h (revision 182660) +++ gcc/config/score/score-protos.h (working copy) @@ -42,8 +42,6 @@ extern bool score_block_move (rtx* ops); extern int score_address_cost (rtx addr, bool speed); extern int score_address_p (enum machine_mode mode, rtx x, int strict); extern int score_reg_class (int regno); -extern int score_register_move_cost (enum machine_mode mode, enum reg_class to, - enum reg_class from); extern int score_hard_regno_mode_ok (unsigned int, enum machine_mode); extern int score_const_ok_for_letter_p (HOST_WIDE_INT value, char c); extern int score_extra_constraint (rtx op, char c); Index: gcc/config/score/score.c =================================================================== --- gcc/config/score/score.c (revision 182660) +++ gcc/config/score/score.c (working copy) @@ -187,6 +187,9 @@ struct extern_list *extern_head = 0; #undef TARGET_TRAMPOLINE_INIT #define TARGET_TRAMPOLINE_INIT score_trampoline_init +#undef TARGET_REGISTER_MOVE_COST +#define TARGET_REGISTER_MOVE_COST score_register_move_cost + /* Return true if SYMBOL is a SYMBOL_REF and OFFSET + SYMBOL points to the same object as SYMBOL. */ static int @@ -998,11 +1001,13 @@ score_legitimate_address_p (enum machine return score_classify_address (&addr, mode, x, strict); } -/* Return a number assessing the cost of moving a register in class +/* Implement TARGET_REGISTER_MOVE_COST. + + Return a number assessing the cost of moving a register in class FROM to class TO. */ -int +static int score_register_move_cost (enum machine_mode mode ATTRIBUTE_UNUSED, - enum reg_class from, enum reg_class to) + reg_class_t from, reg_class_t to) { if (GR_REG_CLASS_P (from)) {