From patchwork Thu Sep 22 20:35:58 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Schmidt X-Patchwork-Id: 116005 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 7116CB6F83 for ; Fri, 23 Sep 2011 06:36:24 +1000 (EST) Received: (qmail 26448 invoked by alias); 22 Sep 2011 20:36:23 -0000 Received: (qmail 26439 invoked by uid 22791); 22 Sep 2011 20:36:21 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Sep 2011 20:36:03 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1R6q02-0007JH-N4 from Bernd_Schmidt@mentor.com ; Thu, 22 Sep 2011 13:36:02 -0700 Received: from [127.0.0.1] ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 22 Sep 2011 21:36:01 +0100 Message-ID: <4E7B9C2E.2090102@codesourcery.com> Date: Thu, 22 Sep 2011 22:35:58 +0200 From: Bernd Schmidt User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20) Gecko/20110920 Lightning/1.0b3pre Thunderbird/3.1.12 MIME-Version: 1.0 To: Richard Henderson CC: GCC Patches , Richard Sandiford Subject: Re: Handle multi-word regsiters in REG_CFA_RESTORE notes References: <4E7150E4.10004@codesourcery.com> <4E72551E.3060307@redhat.com> <4E79FAD7.8000908@codesourcery.com> <4E7A2004.8080603@redhat.com> In-Reply-To: <4E7A2004.8080603@redhat.com> 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 09/21/11 19:33, Richard Henderson wrote: > Why, then, is this the only place in dwarf2cfi that needs to handle > registers via a loop over nregs? It seems to me that we should either > be handling multi-register spans everywhere or nowhere. > > Because alternately, this could be a bug in your backend that you > failed to add two RESTORE notes instead of just one... Well, changing the backend works too. Patch below. Bernd * mips.c (mips_restore_reg): Split multiword registers for REG_CFA_RESTORE notes. Index: gcc/config/mips/mips.c =================================================================== --- gcc/config/mips/mips.c (revision 178847) +++ gcc/config/mips/mips.c (working copy) @@ -10286,16 +10286,28 @@ mips_epilogue_set_cfa (rtx reg, HOST_WID static void mips_restore_reg (rtx reg, rtx mem) { + enum machine_mode mode = GET_MODE (reg); + unsigned regno = REGNO (reg); + /* There's no MIPS16 instruction to load $31 directly. Load into $7 instead and adjust the return insn appropriately. */ - if (TARGET_MIPS16 && REGNO (reg) == RETURN_ADDR_REGNUM) - reg = gen_rtx_REG (GET_MODE (reg), GP_REG_FIRST + 7); + if (TARGET_MIPS16 && regno == RETURN_ADDR_REGNUM) + reg = gen_rtx_REG (mode, GP_REG_FIRST + 7); + else if (GET_MODE_SIZE (mode) != 8 || !mips_split_64bit_move_p (reg, mem)) + mips_epilogue.cfa_restores + = alloc_reg_note (REG_CFA_RESTORE, reg, mips_epilogue.cfa_restores); else - mips_epilogue.cfa_restores = alloc_reg_note (REG_CFA_RESTORE, reg, - mips_epilogue.cfa_restores); + { + rtx word1 = mips_subword (reg, true); + rtx word2 = mips_subword (reg, false); + mips_epilogue.cfa_restores + = alloc_reg_note (REG_CFA_RESTORE, word1, mips_epilogue.cfa_restores); + mips_epilogue.cfa_restores + = alloc_reg_note (REG_CFA_RESTORE, word2, mips_epilogue.cfa_restores); + } - mips_emit_save_slot_move (reg, mem, MIPS_EPILOGUE_TEMP (GET_MODE (reg))); - if (REGNO (reg) == REGNO (mips_epilogue.cfa_reg)) + mips_emit_save_slot_move (reg, mem, MIPS_EPILOGUE_TEMP (mode)); + if (regno == REGNO (mips_epilogue.cfa_reg)) /* The CFA is currently defined in terms of the register whose value we have just restored. Redefine the CFA in terms of the stack pointer. */