From patchwork Thu Jun 16 14:39:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 100653 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 29925B6F93 for ; Fri, 17 Jun 2011 00:39:56 +1000 (EST) Received: (qmail 7569 invoked by alias); 16 Jun 2011 14:39:54 -0000 Received: (qmail 7560 invoked by uid 22791); 16 Jun 2011 14:39:53 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Jun 2011 14:39:39 +0000 Received: (qmail 28216 invoked from network); 16 Jun 2011 14:39:38 -0000 Received: from unknown (HELO ?84.152.178.189?) (bernds@127.0.0.2) by mail.codesourcery.com with ESMTPA; 16 Jun 2011 14:39:38 -0000 Message-ID: <4DFA15A2.50105@codesourcery.com> Date: Thu, 16 Jun 2011 16:39:30 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Lightning/1.0b3pre Thunderbird/3.1.10 MIME-Version: 1.0 To: GCC Patches Subject: Fail entire blocks less often in regrename.c 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 Regrename tends to fall on its face if multiword registers are accessed both in their full width and in subparts. However, there's one case where it's relatively easy to improve the current situation - when tracking a wide register, and it's written to in a narrower mode, we can just close the chain, mark it as non-renameable, and move every involved register to live_hardregs. Bootstrapped and tested along with the earlier REG_DEAD patch. I've been testing these and other changes in a 4.5 C6X tree as well. Bernd * regrename.c (scan_rtx_reg): Handle the case where we write to an open chain in a smaller mode without failing the entire block. Index: gcc/regrename.c =================================================================== --- gcc/regrename.c (revision 174842) +++ gcc/regrename.c (working copy) @@ -753,25 +721,34 @@ scan_rtx_reg (rtx insn, rtx *loc, enum r In either case, we remove this element from open_chains. */ if ((action == terminate_dead || action == terminate_write) - && superset) + && (superset || subset)) { unsigned nregs; head->terminated = 1; + if (subset) + head->cannot_rename = 1; head->next_chain = closed_chains; closed_chains = head; bitmap_clear_bit (&open_chains_set, head->id); nregs = head->nregs; while (nregs-- > 0) - CLEAR_HARD_REG_BIT (live_in_chains, head->regno + nregs); + { + CLEAR_HARD_REG_BIT (live_in_chains, head->regno + nregs); + if (subset + && (head->regno + nregs < this_regno + || head->regno + nregs >= this_regno + this_nregs)) + SET_HARD_REG_BIT (live_hard_regs, head->regno + nregs); + } *p = next; if (dump_file) fprintf (dump_file, - "Closing chain %s (%d) at insn %d (%s)\n", + "Closing chain %s (%d) at insn %d (%s%s)\n", reg_names[head->regno], head->id, INSN_UID (insn), - scan_actions_name[(int) action]); + scan_actions_name[(int) action], + superset ? ", superset" : subset ? ", subset" : ""); } else if (action == terminate_dead || action == terminate_write) {