From: Nick Clifton <nickc@redhat.com>
To: Jeff Law <law@redhat.com>, gcc-patches@gcc.gnu.org
Cc: gdb-patches@sourceware.org
Subject: Re: RFA: Generate normal DWARF DW_LOC descriptors for non integer mode pointers
Date: Thu, 26 May 2016 16:16:00 -0000 [thread overview]
Message-ID: <424fe5c1-a849-6d4d-fdca-ac531e8ee53b@redhat.com> (raw)
In-Reply-To: <9f8e1f36-5186-67bc-898e-6910e0d041a6@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2344 bytes --]
Hi Jeff,
>>> I may be missing something, but isn't it the transition to an FP
>>> relative address rather than a SP relative address that's the problem
>>> here?
>>
>> Yes, I believe so.
>>
>>> Where does that happen?
I think that it happens in dwarf2out.c:based_loc_descr() which
detects the use of the frame pointer and works out that it is going
to be eliminated to the stack pointer:
/* We only use "frame base" when we're sure we're talking about the
post-prologue local stack frame. We do this by *not* running
register elimination until this point, and recognizing the special
argument pointer and soft frame pointer rtx's. */
if (reg == arg_pointer_rtx || reg == frame_pointer_rtx)
{
rtx elim = (ira_use_lra_p
? lra_eliminate_regs (reg, VOIDmode, NULL_RTX)
: eliminate_regs (reg, VOIDmode, NULL_RTX));
if (elim != reg)
.....
The problem, I believe, is that based_loc_descr() is only called
from mem_loc_descriptor when the mode of the rtl concerned is an
MODE_INT. For example:
case REG:
if (GET_MODE_CLASS (mode) != MODE_INT
[...]
else
if (REGNO (rtl) < FIRST_PSEUDO_REGISTER)
mem_loc_result = based_loc_descr (rtl, 0, VAR_INIT_STATUS_INITIALIZED);
or, (this is another one that I found whilst investigating this
problem further):
case PLUS:
plus:
if (is_based_loc (rtl)
&& (GET_MODE_SIZE (mode) <= DWARF2_ADDR_SIZE
|| XEXP (rtl, 0) == arg_pointer_rtx
|| XEXP (rtl, 0) == frame_pointer_rtx)
&& GET_MODE_CLASS (mode) == MODE_INT)
mem_loc_result = based_loc_descr (XEXP (rtl, 0),
INTVAL (XEXP (rtl, 1)),
VAR_INIT_STATUS_INITIALIZED);
else
There are quite a few places in mem_loc_descriptor where the code checks
for the mode being in the MODE_INT class. I am not exactly sure why. I
think that it might be that the programmer thought that any expression that
does not involve integer based arithmetic cannot be expressed in DWARF CFA
notation and so would have to be handled specially. If I am correct,
then it seems to me that the proper fix would be to use SCALAR_INT_MODE_P
instead.
I tried out the extended patch (attached) and it gave even better GDB
results for the MSP430 and still no regressions (GCC or GDB) for MSP430 or
x86_64.
Is this enough justification ?
Cheers
Nick
[-- Attachment #2: dwarf2out.c.patch.2 --]
[-- Type: application/x-troff-man, Size: 10502 bytes --]
next prev parent reply other threads:[~2016-05-26 16:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-16 14:12 Nick Clifton
2016-05-16 20:08 ` Jeff Law
2016-05-17 12:37 ` Nick Clifton
[not found] ` <9f8e1f36-5186-67bc-898e-6910e0d041a6@redhat.com>
2016-05-26 16:16 ` Nick Clifton [this message]
2016-06-21 22:09 ` Jeff Law
2016-06-22 15:13 ` Nick Clifton
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=424fe5c1-a849-6d4d-fdca-ac531e8ee53b@redhat.com \
--to=nickc@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=law@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