From: Bernd Schmidt <bernds@codesourcery.com>
To: Richard Henderson <rth@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
Richard Sandiford <rdsandiford@googlemail.com>
Subject: Re: Handle multi-word regsiters in REG_CFA_RESTORE notes
Date: Thu, 22 Sep 2011 22:09:00 -0000 [thread overview]
Message-ID: <4E7B9C2E.2090102@codesourcery.com> (raw)
In-Reply-To: <4E7A2004.8080603@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 433 bytes --]
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
[-- Attachment #2: mips-ep64.diff --]
[-- Type: text/plain, Size: 1855 bytes --]
* 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. */
next prev parent reply other threads:[~2011-09-22 20:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-15 2:42 Bernd Schmidt
2011-09-15 20:41 ` Richard Henderson
2011-09-21 15:14 ` Bernd Schmidt
2011-09-21 17:47 ` Richard Henderson
2011-09-22 22:09 ` Bernd Schmidt [this message]
2011-09-25 19:54 ` Richard Sandiford
2011-09-27 12:57 ` Bernd Schmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E7B9C2E.2090102@codesourcery.com \
--to=bernds@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rdsandiford@googlemail.com \
--cc=rth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).