public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@redhat.com>
To: Mark Mitchell <mark@codesourcery.com>
Cc: Ian Lance Taylor <iant@google.com>,
	        Richard Guenther <richard.guenther@gmail.com>,
	gcc-patches@gcc.gnu.org,         gcc@gcc.gnu.org
Subject: Re: Designs for better debug info in GCC
Date: Mon, 12 Nov 2007 18:22:00 -0000	[thread overview]
Message-ID: <oroddzxsfy.fsf@oliva.athome.lsd.ic.unicamp.br> (raw)
In-Reply-To: <4737BBBF.3080400@codesourcery.com> (Mark Mitchell's message of "Sun\, 11 Nov 2007 18\:34\:39 -0800")

On Nov 12, 2007, Mark Mitchell <mark@codesourcery.com> wrote:

> (We may already have lost some information, though.  For example, given:

>   i = 3;
>   f(i);
>   i = 7;
>   i = 2;
>   g(i);

> we may well have lost the "i = 7" assignment, so "i" might appear to
> have the value "3" right before we assign "2" to it, if we were to
> generate debug information right then.)

Yup.  And even if we could somehow preserve that information, there
wouldn't be any code to attach that information to.  There might be
uses for empty-range locations in debug information, but I can't think
of any.  Can anyone?  It's something we could try to preserve, and
with my design it would be quite easy to do so, but unless it's useful
for some purpose, I think we could just do away with it.

> The reason I want to make that assumption is that the part of this where
> the representation is in question is once we reach RTL, right?

I'm not sure what is in question at all.  I've proposed a design to
preserve debug information throughout compilation.  Other designs on
the table differ both in tree and rtl levels, and in the potential
quality and correctness of the debug information they can produce.

> I guess I still don't really understand what you're doing at the RTL
> level.

It's no different, except that instead of a DEBUG_STMT it's a
DEBUG_INSN, with the TREE exprssion converted to an RTL expression.

/me mumbles something about the silliness of keeping two completely
different yet nearly-isomorphic internal representations for
statements/instructions.

> What I don't understand is how it's actually going to work.  What
> are the notes you're inserting?

They're always of the form

  DEBUG user-variable = expression

where DEBUG stands for a DEBUG_STMT or a DEBUG_INSN, user-variable is
a tree that represents the user variable, and expression is a TREE or
RTL (depending on which representation we're in) that evaluates to the
value the user-variable is expected to hold at that point in the
program.

> Do they just say "here is an RTL expression for computing the value of
> user-variable V at this point in the program"?

In RTL, yes.

> Why does it make sense to have that, rather than notes on
> instructions that say what affect the instruction has on user
> variables?

Few instructions need such notes, so the proposal of growing SET by
33% doesn't quite appeal to me.  And then, optimizations move
instructions around, but I don't think they should move the assignment
notes around, for they should reflect the structure of the source
program, rather than the mangled representation that the optimizers
turn it into.

That said, growing SET to add to it a list of variables (or components
thereof) that the variable is assigned to could be made to work, to
some extent.  But when you optimize away such a set, you'd still have
to keep the note around, so it's not clear to me that adding code all
over to maintain the notes in place when the SETs go away or are
juggled around would bring us any advantage.  It would be just a
redundant notation for what the note would already convey, so it just
brings complexity for no actual advantage.

To make it concrete, consider that your example above could have become:

(set (reg i) (const_int 3)) ;; assigns to i
(set (reg P1) (reg i))
(call (mem f))
(set (reg i) (const_int 7)) ;; assigns to i
(set (reg i) (const_int 2)) ;; assigns to i
(set (reg P1) (reg i))
(call (mem g))

could have been optimized to:

(set (reg P1) (const_int 3))
(call (mem f))
(set (reg P1) (const_int 2))
(call (mem g))

and then you wouldn't have any debug information left for variable i.

whereas with the notes I propose, you'd be left with:

(debug i (const_int 3))
(set (reg P1) (const_int 3))
(call (mem f))
(debug i (const_int 7)) ;; may be dropped, as discussed above
(debug i (const_int 2))
(set (reg P1) (const_int 2))
(call (mem g))

even if no register at all ends up allocated for i.  And if there were
uses of i that followed the assignment to 7, to which the constant
could be propagated, you'd still be left with the annotation to
indicate that i has a new value at the correct point.

> As a meta-question, have you or anyone else on the list looked at the
> literature (IEEE/ACM, etc.) or how other compilers handle these problems?

I couldn't find much information about other compilers, but I've see a
number of (mostly dated) articles and US patents.  In fact, I'm
particularly concerned that US Patent 6091896 covers the design
proposed by Richi, that involves annotating the instructions
themselves.  I believe the independent, stand-alone annotations I
propose escape the patent claims.

That said, if anyone knows of articles that could be of use, I'd love
to hear about them.  It's not like my research was exhaustive.

-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
FSF Latin America Board Member         http://www.fsfla.org/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

  reply	other threads:[~2007-11-12 17:54 UTC|newest]

Thread overview: 192+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <or4pg114h5.fsf@oliva.athome.lsd.ic.unicamp.br>
     [not found] ` <84fc9c000711050327x74845c78ya18a3329fcf9e4d2@mail.gmail.com>
2007-11-07  8:03   ` Designs for better debug info in GCC (was: Re: [vta] don't let debug insns get in the way of simple vect reduction) Alexandre Oliva
2007-11-07 16:37     ` Ian Lance Taylor
2007-11-07 21:43       ` Designs for better debug info in GCC Alexandre Oliva
2007-11-07 23:05         ` Ian Lance Taylor
2007-11-07 23:28           ` Daniel Jacobowitz
2007-11-08  0:01           ` Mark Mitchell
2007-11-08  0:28             ` David Edelsohn
2007-11-08  5:01               ` Mark Mitchell
2007-11-08  5:15                 ` Alexandre Oliva
2007-11-08 18:44                   ` Alexandre Oliva
2007-11-23  2:20                 ` Frank Ch. Eigler
2007-11-23  2:30                   ` Richard Guenther
2007-11-23 23:40                     ` Frank Ch. Eigler
2007-11-23 23:56                       ` Alexandre Oliva
2007-11-24 13:52                     ` Robert Dewar
2007-11-08  5:44               ` Alexandre Oliva
2007-11-08 18:37                 ` Alexandre Oliva
2007-11-08 20:51                 ` Andrew Pinski
2007-11-09  1:11                   ` Alexandre Oliva
2007-11-09 11:28                   ` Robert Dewar
2007-11-08  6:39             ` Alexandre Oliva
2007-11-08 19:13               ` Alexandre Oliva
2007-11-08 20:07               ` Mark Mitchell
2007-11-08 20:14                 ` David Daney
2007-11-08 20:41                   ` Mark Mitchell
2007-11-09  9:10                 ` Alexandre Oliva
2007-11-12 10:55                   ` Mark Mitchell
2007-11-12 18:22                     ` Alexandre Oliva [this message]
2007-11-12 20:08                       ` Joe Buck
2007-11-24 22:12                         ` Alexandre Oliva
2007-11-24 22:42                           ` Richard Kenner
2007-11-12 22:43                       ` Ian Lance Taylor
2007-11-24  1:44                         ` Alexandre Oliva
2007-11-13 10:50                       ` Mark Mitchell
2007-11-24  4:05                         ` Alexandre Oliva
2007-11-13 15:46                       ` Michael Matz
2007-11-23 23:56                         ` Alexandre Oliva
2007-11-26 18:19                           ` Michael Matz
2007-11-27  7:31                             ` Alexandre Oliva
2007-11-27 18:33                               ` Michael Matz
2007-11-27 20:37                                 ` Alexandre Oliva
2007-11-08 10:11             ` Richard Guenther
2007-11-08  5:14           ` Alexandre Oliva
2007-11-08 18:28             ` Alexandre Oliva
2007-11-08 19:23             ` Ian Lance Taylor
2007-11-09  0:08               ` Alexandre Oliva
2007-11-09  1:26                 ` Ian Lance Taylor
2007-11-09 12:22                   ` Robert Dewar
2007-11-12 12:59                     ` Mark Mitchell
2007-11-12 18:05                       ` Alexandre Oliva
2007-11-12 18:09                         ` Mark Mitchell
2007-11-24  4:31                           ` Alexandre Oliva
2007-11-26  6:10                             ` Mark Mitchell
2007-12-05 14:21                               ` Diego Novillo
2007-12-05 22:10                                 ` Joe Buck
2007-12-15 22:51                                 ` Alexandre Oliva
2007-12-16  6:27                                   ` Daniel Berlin
2007-12-16 12:47                                     ` Alexandre Oliva
2007-12-17  1:27                                       ` Daniel Berlin
2007-12-17  5:38                                         ` Joe Buck
2007-12-17  8:20                                           ` Geert Bosch
2007-12-18  1:24                                             ` Alexandre Oliva
2007-12-18  2:02                                               ` Joe Buck
2007-12-18  4:40                                                 ` Alexandre Oliva
2007-12-18  7:45                                                   ` Robert Dewar
2007-12-18  7:56                                                     ` Alexandre Oliva
2007-12-18 13:29                                                       ` Robert Dewar
2007-12-18 22:15                                                         ` Alexandre Oliva
2007-12-18  6:16                                               ` Robert Dewar
2007-12-18  8:09                                                 ` Alexandre Oliva
2007-12-17 18:33                                           ` Alexandre Oliva
2007-12-17 17:59                                         ` Alexandre Oliva
2007-12-17 18:02                                           ` Diego Novillo
2007-12-17 20:43                                             ` Alexandre Oliva
2007-12-17 21:20                                               ` Diego Novillo
2007-12-18  1:01                                                 ` Alexandre Oliva
2007-12-18  1:14                                                   ` Diego Novillo
2007-12-18  5:17                                                     ` Alexandre Oliva
2007-12-18  8:06                                                       ` Kai Henningsen
2007-12-18  8:39                                                       ` Alexandre Oliva
2007-12-18 13:15                                                         ` Diego Novillo
2007-12-18 15:06                                                           ` Alexandre Oliva
2007-12-18 16:22                                                         ` Ian Lance Taylor
2007-12-18 16:28                                                           ` Robert Dewar
2007-12-18 16:31                                                             ` Andrew Haley
2007-12-18 16:42                                                               ` Robert Dewar
2007-12-18 17:04                                                                 ` Andrew Haley
2007-12-18 17:12                                                               ` Richard Kenner
2007-12-18 16:32                                                             ` Daniel Jacobowitz
2007-12-18 16:44                                                               ` Robert Dewar
2007-12-19  4:30                                                           ` Alexandre Oliva
2007-12-19 18:41                                                             ` Ian Lance Taylor
2007-12-19 19:00                                                               ` Daniel Jacobowitz
2007-12-19 19:53                                                               ` Janis Johnson
2007-12-19 21:17                                                                 ` Ian Lance Taylor
2007-12-20  6:10                                                                   ` Alexandre Oliva
2007-12-20 16:52                                                                     ` Ian Lance Taylor
2007-12-20 21:38                                                                       ` Alexandre Oliva
2007-12-21  1:54                                                                         ` Ian Lance Taylor
     [not found]                                                                           ` <orprx0izhp.fsf@oliva.atho! me.lsd.ic.unicamp.br>
2007-12-21  2:11                                                                           ` Alexandre Oliva
2007-12-21  3:16                                                                             ` Robert Dewar
2007-12-21  5:10                                                                             ` Ian Lance Taylor
2007-12-21 18:12                                                                               ` Alexandre Oliva
2007-12-21 19:32                                                                                 ` Ian Lance Taylor
2007-12-21 22:46                                                                                   ` Alexandre Oliva
2007-12-22  0:07                                                                                     ` Ian Lance Taylor
2007-12-22  0:09                                                                                       ` Andrew Pinski
2007-12-22  3:16                                                                                         ` Andrew Pinski
2007-12-22 11:44                                                                                           ` Chris Lattner
2007-12-22 21:27                                                                                             ` Ian Lance Taylor
2007-12-23 17:40                                                                                       ` Frank Ch. Eigler
2007-12-22  7:38                                                                                     ` Robert Dewar
2007-12-22 13:33                                                                                     ` Andrew Haley
2007-12-22 17:11                                                                                       ` Robert Dewar
2007-12-31 19:39                                                                           ` Alexandre Oliva
2007-12-20  8:00                                                               ` Alexandre Oliva
2007-12-20  8:01                                                                 ` Alexandre Oliva
2007-12-20 17:02                                                                 ` Ian Lance Taylor
2007-12-31 16:55                                                           ` Richard Guenther
     [not found]                                                             ` <y0my7baigdf.fsf@ton.toronto.redhat.com>
2008-01-01 17:31                                                               ` Richard Guenther
2007-12-18 23:19                                                         ` Daniel Berlin
2007-12-19  6:07                                                           ` Alexandre Oliva
2007-12-19  6:18                                                             ` Daniel Berlin
2007-12-19 16:01                                                               ` Daniel Berlin
2007-12-19 16:29                                                                 ` Andrew MacLeod
2007-12-19 19:25                                                                   ` Daniel Berlin
2007-12-19 20:00                                                                 ` Andrew MacLeod
2007-12-19 20:40                                                                   ` Daniel Berlin
2007-12-19 20:00                                                                 ` Alexandre Oliva
2007-12-19 21:11                                                                   ` Daniel Berlin
2007-12-20  5:16                                                                     ` Alexandre Oliva
2007-12-20 16:44                                                                       ` Ian Lance Taylor
2007-12-20 20:42                                                                         ` Alexandre Oliva
2007-12-19 20:03                                                               ` Alexandre Oliva
2007-12-18 23:31                                                         ` Daniel Berlin
2007-12-19  4:35                                                           ` Alexandre Oliva
2007-12-19 16:12                                                             ` Daniel Berlin
2007-12-19 19:13                                                               ` Alexandre Oliva
2007-12-19 20:11                                                                 ` Daniel Jacobowitz
2007-12-31 14:45                                               ` Richard Guenther
2007-12-16 22:20                                   ` Mark Mitchell
2007-11-09 12:31                   ` Seongbae Park (박성배, 朴成培)
2007-11-09 12:42                     ` Robert Dewar
2007-11-07 17:25     ` Designs for better debug info in GCC (was: Re: [vta] don't let debug insns get in the way of simple vect reduction) Michael Matz
2007-11-07 19:03       ` Designs for better debug info in GCC Alexandre Oliva
2007-11-08 11:22         ` Michael Matz
2007-11-08 15:13           ` Robert Dewar
2007-11-08 16:11             ` H.J. Lu
2007-11-08 16:32             ` Michael Matz
2007-11-08 18:18               ` Alexandre Oliva
2007-11-09 14:23                 ` Michael Matz
2007-11-12 18:17                   ` Alexandre Oliva
2007-11-13 14:22                     ` Michael Matz
2007-11-24  4:58                       ` Alexandre Oliva
2007-11-26 18:10                         ` Michael Matz
2007-11-27  3:48                           ` Alexandre Oliva
2007-11-08 17:48             ` Alexandre Oliva
2007-11-09  2:09               ` Robert Dewar
2007-11-12 17:52                 ` Alexandre Oliva
2007-11-09  2:13               ` Joe Buck
2007-11-09 18:40                 ` Daniel Jacobowitz
2007-11-09 19:02                   ` Robert Dewar
2007-11-08 16:37           ` Alexandre Oliva
2007-11-13  7:52 Steven Bosscher
2007-11-23 23:40 ` Alexandre Oliva
2007-11-24 10:27   ` Steven Bosscher
2007-11-24 15:08     ` Alexandre Oliva
2007-11-24 15:18       ` Richard Kenner
2007-11-24 20:21         ` Alexandre Oliva
2007-11-24 20:48           ` Bernd Schmidt
2007-11-24 22:01             ` Alexandre Oliva
2007-11-24 22:34               ` Richard Guenther
2007-11-25  1:21                 ` Alexandre Oliva
2007-11-25  2:36                   ` Richard Guenther
2007-11-26 11:37                     ` Alexandre Oliva
2007-11-26 12:38                       ` Richard Guenther
2007-11-26 18:10                         ` Alexandre Oliva
2007-11-25  0:20               ` Alexandre Oliva
2007-11-24 21:24           ` Richard Kenner
2007-11-24 21:55             ` Alexandre Oliva
2007-11-25  0:39           ` Robert Dewar
2007-12-15 20:32             ` Alexandre Oliva
2007-12-15 21:41               ` Robert Dewar
2007-11-24 16:07       ` Steven Bosscher
2007-11-24 20:11         ` Alexandre Oliva
2007-11-24 20:46           ` Richard Guenther
2007-11-26 18:36 J.C. Pizarro
2007-11-26 18:55 ` J.C. Pizarro
     [not found] <or4pg114h5.fsf@oliva.athome.lsd.ic.unicamp.br.suse.lists.egcs>
     [not found] ` <orsl1xq4p3.fsf@oliva.athome.lsd.ic.unicamp.br.suse.lists.egcs>
     [not found]   ` <m3ir2t2u57.fsf@localhost.localdomain.suse.lists.egcs>
     [not found]     ` <m3tzmd1209.fsf@localhost.localdomain.suse.lists.egcs>
     [not found]       ` <m34pec1x4k.fsf@localhost.localdomain.suse.lists.egcs>
     [not found]         ` <orwsr8eyz5.fsf@oliva.athome.lsd.ic.unicamp.br.suse.lists.egcs>
     [not found]           ` <m3wsr76hov.fsf@localhost.localdomain.suse.lists.egcs>
     [not found]             ` <or8x3ng5ie.fsf@oliva.athome.lsd.ic.unicamp.br.suse.lists.egcs>
     [not found]               ` <m3r6hf4mw1.fsf@localhost.localdomain.suse.lists.egcs>
     [not found]                 ` <de8d50360712211607h77a0add5h794f6b5781b6491b@mail.gmail.com.suse.lists.egcs>
     [not found]                   ` <de8d50360712211609y643b8affpeb91048dedecbe60@mail.gmail.com.suse.lists.egcs>
     [not found]                     ` <7C283DB3-9716-4B2C-9721-D1F503B91CC4@apple.com.suse.lists.egcs>
     [not found]                       ` <m37ij64mwt.fsf@localhost.localdomain.suse.lists.egcs>
2007-12-23  0:52                         ` Andi Kleen
2007-12-23  1:32                           ` Daniel Jacobowitz
2007-12-23  1:36                             ` Andi Kleen
2007-12-23  5:55                               ` Daniel Jacobowitz

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=oroddzxsfy.fsf@oliva.athome.lsd.ic.unicamp.br \
    --to=aoliva@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=iant@google.com \
    --cc=mark@codesourcery.com \
    --cc=richard.guenther@gmail.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).