From patchwork Wed May 30 18:21:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 162047 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 97E69B7021 for ; Thu, 31 May 2012 04:22:13 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1339006934; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Mail-Followup-To:Cc:Subject:References:Date: In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=DoSecKir3d6DJYFBPJBm /0JbfPg=; b=sEgj1acZ3vitPj5diQZvNyo80dlnzhmAsyBz7fw4avVlA9rufzfy kbwzCKNTWQVVNn3KP+MgDPF0nopGm3YGLTgb9UV5adi7BY+hxOthmz53lnVMImDv BdrvgQeVqlOPsMMzxBr/Lj1Oo2GF+j2eFsoIfslHcqoKkksOSpQYx+A= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Mail-Followup-To:Cc:Subject:References:Date:In-Reply-To:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=fC0J7/P5lkqHbdamTmUQhnXPRvlIu3lwFg/WC67s+KyvpJENl3NXmBdhv3yICR FR8OfS31VU+FCgwX2SxGwmooEHo/U3V8mEMHuEMQrEx2yO4Z/mf9kuavBnyfI+/1 proJwji4EZxw93aIrt+8EbOmlGGMYncUcWExnjHN6q7VE=; Received: (qmail 26002 invoked by alias); 30 May 2012 18:22:09 -0000 Received: (qmail 25993 invoked by uid 22791); 30 May 2012 18:22:08 -0000 X-SWARE-Spam-Status: No, hits=-4.1 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-wg0-f51.google.com (HELO mail-wg0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 30 May 2012 18:21:55 +0000 Received: by wgbed3 with SMTP id ed3so86679wgb.8 for ; Wed, 30 May 2012 11:21:54 -0700 (PDT) Received: by 10.216.141.84 with SMTP id f62mr11350321wej.91.1338402114080; Wed, 30 May 2012 11:21:54 -0700 (PDT) Received: from localhost (rsandifo.gotadsl.co.uk. [82.133.89.107]) by mx.google.com with ESMTPS id dg2sm1390197wib.4.2012.05.30.11.21.52 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 May 2012 11:21:53 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, vmakarov@redhat.com, rdsandiford@googlemail.com Cc: vmakarov@redhat.com Subject: [2/7] Tidy IRA move costs References: <87d35lh72w.fsf@talisman.home> Date: Wed, 30 May 2012 19:21:52 +0100 In-Reply-To: <87d35lh72w.fsf@talisman.home> (Richard Sandiford's message of "Wed, 30 May 2012 19:11:51 +0100") Message-ID: <874nqxh6m7.fsf@talisman.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) MIME-Version: 1.0 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 The only part of IRA that uses move_costs directly is copy_cost. It looks like this might be an oversight, since all related costs already use ira_register_move_cost. As mentioned in the covering message, the two arrays are usually the same anyway. The only hitch is that we have: if (!move_cost[mode]) init_move_cost (mode); so if the move costs for this mode really haven't been calculated yet, we could potentially end up with different costs then if we used the normal ira_init_register_move_cost_if_necessary route. In the former case we'd use the original move_cost (before the IRA modifications), while in the latter we'd use the value assigned by ira_init_register_move_cost via the ira_register_move_cost alias. Richard gcc/ * ira-costs.c (copy_cost): Use ira_init_register_move_cost_if_necessary and ira_register_move_cost instead of init_move_cost and move_cost. Index: gcc/ira-costs.c =================================================================== --- gcc/ira-costs.c 2012-05-30 18:57:09.040912969 +0100 +++ gcc/ira-costs.c 2012-05-30 19:16:22.921879419 +0100 @@ -359,9 +359,8 @@ copy_cost (rtx x, enum machine_mode mode if (secondary_class != NO_REGS) { - if (!move_cost[mode]) - init_move_cost (mode); - return (move_cost[mode][(int) secondary_class][(int) rclass] + ira_init_register_move_cost_if_necessary (mode); + return (ira_register_move_cost[mode][(int) secondary_class][(int) rclass] + sri.extra_cost + copy_cost (x, mode, secondary_class, to_p, &sri)); } @@ -374,10 +373,11 @@ copy_cost (rtx x, enum machine_mode mode + ira_memory_move_cost[mode][(int) rclass][to_p != 0]; else if (REG_P (x)) { - if (!move_cost[mode]) - init_move_cost (mode); + reg_class_t x_class = REGNO_REG_CLASS (REGNO (x)); + + ira_init_register_move_cost_if_necessary (mode); return (sri.extra_cost - + move_cost[mode][REGNO_REG_CLASS (REGNO (x))][(int) rclass]); + + ira_register_move_cost[mode][(int) x_class][(int) rclass]); } else /* If this is a constant, we may eventually want to call rtx_cost