From patchwork Tue Nov 9 15:38:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 70553 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 03566B70AA for ; Wed, 10 Nov 2010 02:38:45 +1100 (EST) Received: (qmail 22822 invoked by alias); 9 Nov 2010 15:38:41 -0000 Received: (qmail 22718 invoked by uid 22791); 9 Nov 2010 15:38:40 -0000 X-SWARE-Spam-Status: No, hits=-6.2 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 09 Nov 2010 15:38:34 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oA9FcX7n008868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 9 Nov 2010 10:38:33 -0500 Received: from toll.yyz.redhat.com (toll.yyz.redhat.com [10.15.16.165]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id oA9FcWkC004730; Tue, 9 Nov 2010 10:38:32 -0500 Message-ID: <4CD96AF8.3010500@redhat.com> Date: Tue, 09 Nov 2010 10:38:32 -0500 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100921 Fedora/3.1.4-1.fc13 Thunderbird/3.1.4 MIME-Version: 1.0 To: Andreas Krebbel CC: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] ira: Respect HARD_REGNO_CALL_PART_CLOBBERED References: <20101021171457.GA6994@bart> <4CD41BFB.9070706@redhat.com> <20101108160804.GA4718@bart> In-Reply-To: <20101108160804.GA4718@bart> 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 On 11/08/2010 11:08 AM, Andreas Krebbel wrote: > Hi Vladimir, > > here are updated versions of the patches. > > I've verified that the 4.5 as well as the mainline version still fixes > the testcase for me. > > Ok for 4.5 and mainline? > > Bye, > > -Andreas- > > > 2010-11-08 Andreas Krebbel > > PR rtl-optimization/46237 > * ira-conflicts.c (ira_build_conflicts): Record conflicts for call > saved hard regs if they might get partially clobbered. > > > For GCC mainline: > > Index: gcc/ira-conflicts.c > =================================================================== > *** gcc/ira-conflicts.c.orig > --- gcc/ira-conflicts.c > *************** ira_build_conflicts (void) > *** 882,887 **** > --- 882,888 ---- > ira_object_t obj = ALLOCNO_OBJECT (a, i); > reg_attrs *attrs = REG_ATTRS (regno_reg_rtx [ALLOCNO_REGNO (a)]); > tree decl; > + int regno; > > if ((! flag_caller_saves&& ALLOCNO_CALLS_CROSSED_NUM (a) != 0) > /* For debugging purposes don't put user defined variables in > *************** ira_build_conflicts (void) > *** 896,901 **** > --- 897,912 ---- > call_used_reg_set); > IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), > call_used_reg_set); > + > + /* Allocnos bigger than the saved part of call saved > + regs must conflict with them. */ > + for (regno = 0; regno< FIRST_PSEUDO_REGISTER; regno++) > + if (!TEST_HARD_REG_BIT (call_used_reg_set, regno) > + && HARD_REGNO_CALL_PART_CLOBBERED (regno, obj->allocno->mode)) > + { > + SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno); > + SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), regno); > + } > } > else if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0) > { > It is close but the code should work independently from -fcaller-saves. So it should look like the patch in the attachment. And gcc4.5 patch change should be analogous. With this change, the patch is ok for trunk and gcc4.5. Thanks for working on the PR. Index: ira-conflicts.c =================================================================== --- ira-conflicts.c (revision 165518) +++ ira-conflicts.c (working copy) @@ -877,6 +884,8 @@ ira_build_conflicts (void) FOR_EACH_ALLOCNO (a, ai) { int i, n = ALLOCNO_NUM_OBJECTS (a); + int regno; + for (i = 0; i < n; i++) { ira_object_t obj = ALLOCNO_OBJECT (a, i); @@ -907,6 +916,21 @@ ira_build_conflicts (void) no_caller_save_reg_set); IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), temp_hard_reg_set); + + } + if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0) + { + /* Allocnos bigger than the saved part of call saved + regs must conflict with them. */ + for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) + if (!TEST_HARD_REG_BIT (call_used_reg_set, regno) + && HARD_REGNO_CALL_PART_CLOBBERED (regno, + obj->allocno->mode)) + { + SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno); + SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), + regno); + } } } }