public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@seketeli.org>
To: David Malcolm <dmalcolm@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 4/5] Implement tree expression tracking in C FE (v2)
Date: Fri, 25 Sep 2015 16:36:00 -0000	[thread overview]
Message-ID: <86fv22lblm.fsf@seketeli.org> (raw)
In-Reply-To: <1443192820.30732.80.camel@surprise> (David Malcolm's message of	"Fri, 25 Sep 2015 10:53:40 -0400")

David Malcolm <dmalcolm@redhat.com> a écrit:

> On Fri, 2015-09-25 at 16:06 +0200, Dodji Seketeli wrote:
>> Hello,
>> 
>> Similarly to a comment I made on the previous patch of the series,
>> 
>> +++ b/libcpp/include/line-map.h
>> 
>> [...]
>> 
>>      struct GTY(()) location_adhoc_data {
>>        source_location locus;
>>     +  source_range src_range;
>>        void * GTY((skip)) data;
>>      };
>> 
>> Could we just change the type of locus and make it be a source_range
>> instead?  With the right converting constructor (in the source_range
>> class) that takes a source_location, the amount of churn should
>> hopefully be minimized, or maybe I am missing something ...
>
> Thanks.
>
> I think that the above is one place where we *would* want both locus and
> src_range.

Right, as opposed to the token case where conceptually, all we need is
the begining and the end of the token.  My confusion.

[...]

> As noted elsewhere, we might try to pack short ranges directly into the
> 32 bits of source_location:
>  https://gcc.gnu.org/ml/gcc-patches/2015-09/msg01826.html
> which would avoid having to use ad-hoc for such short ranges; ideally
> most tokens.  I'm experimenting with that (I don't have it fully working
> yet).

Right.  My personal inclination would be to make the general case of
storing all ranges in this adhoc data structure, or, even, into another
on-the-side data structure, similar to the adhoc one, but dedicated to
range associated to points, as you see fit.

Then when that works, consider the optimization of stuffing short ranges
into the 32 bits of source_location, depending on the memory profiles we
get.  But it's your call :-)

[...]

>> +location_t
>> +set_block (location_t loc, tree block)
>> +{
>> 
>> Likewise.  I am wondering if we shouldn't even change the name of this
>> function to better suit what it does: associate a tree to a location.
>
> "associate_tree_with_location" ?

If you find it cool, I am cool :-)

[...]

>> +++ b/gcc/c/c-tree.h
>> @@ -132,6 +132,9 @@ struct c_expr
>>       The type of an enum constant is a plain integer type, but this
>>       field will be the enum type.  */
>>    tree original_type;
>> +
>> +  /* FIXME.  */
>> +  source_range src_range;
>>  };
>> 
>> Why a FIXME here?
>
> To remind myself before posting the patches that I need to give the
> field a descriptive comment, explaining what purpose it serves.
>
> Oops :)
>
> It probably should read something like this:
>
>   /* The source range of this C expression.  This might
>      be thought of as redundant, since ranges for
>      expressions can be stored in a location_t, but
>      not all tree nodes in expressions have a location_t.
>
>      Consider this source code:  
>
> 	int test (int foo)
> 	{
> 	  return foo * 100;
>                 ^^^   ^^^
>        }
>
>     During C parsing, the ranges for "foo" and "100" are
>     stored within this field of c_expr, but after parsing
>     to GENERIC, all we have is a VAR_DECL and an
>     INTEGER_CST (the former's location is in at the top of the
>     function, and the latter has no location).
>
>     For consistency, we store ranges for all expressions
>     in this field, not just those that don't have a
>     location_t. */
>   source_range src_range;

Great, thanks.

[...]

> [BTW, I'm about to disappear on a vacation from tomorrow until October
> 6th, and will be away from email and computers]

Thanks for the heads-up.

Cheers,

-- 
		Dodji

  reply	other threads:[~2015-09-25 16:15 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22 21:09 [PATCH 0/5] RFC: Overhaul of diagnostics (v2) David Malcolm
2015-09-22 21:09 ` [PATCH 1/5] Testsuite: add dg-{begin|end}-multiline-output commands David Malcolm
2015-09-25 17:22   ` Jeff Law
2015-09-27  1:29     ` Bernhard Reutner-Fischer
2015-09-22 21:10 ` [PATCH 3/5] Implement token range tracking within libcpp and the C FE (v2) David Malcolm
2015-09-25  9:58   ` Dodji Seketeli
2015-09-25 14:53     ` David Malcolm
2015-09-25 16:15       ` Dodji Seketeli
2015-09-22 21:10 ` [PATCH 5/5] Add plugin to recursively dump the source-ranges in a tree (v2) David Malcolm
2015-09-28  8:23   ` Dodji Seketeli
2015-09-22 21:33 ` [PATCH 2/5] Reimplement diagnostic_show_locus, introducing rich_location classes (v2) David Malcolm
2015-09-25  9:49   ` Dodji Seketeli
2015-09-25 12:34     ` Manuel López-Ibáñez
2015-09-25 16:21       ` Dodji Seketeli
2015-09-25 20:39     ` [PATCH] v3 of diagnostic_show_locus and rich_location (was Re: [PATCH 2/5] Reimplement diagnostic_show_locus, introducing rich_location classes (v2)) David Malcolm
2015-09-25 20:42       ` Manuel López-Ibáñez
2015-09-25 21:14         ` Manuel López-Ibáñez
2015-09-25 22:10           ` Manuel López-Ibáñez
2015-09-26  4:51             ` David Malcolm
2015-09-26  6:18               ` Manuel López-Ibáñez
2015-09-25 22:40           ` David Malcolm
2015-09-26  6:41             ` Manuel López-Ibáñez
2015-09-27 14:19       ` Dodji Seketeli
2015-10-12 15:45         ` [PATCH] v4 of diagnostic_show_locus and rich_location David Malcolm
2015-10-12 16:37           ` Manuel López-Ibáñez
2015-10-13 18:09             ` David Malcolm
2015-12-29 20:55       ` [PATCH] v3 of diagnostic_show_locus and rich_location (was Re: [PATCH 2/5] Reimplement diagnostic_show_locus, introducing rich_location classes (v2)) Mike Stump
2016-01-06 15:37         ` David Malcolm
2015-09-22 22:23 ` [PATCH 4/5] Implement tree expression tracking in C FE (v2) David Malcolm
2015-09-25 14:22   ` Dodji Seketeli
2015-09-25 15:04     ` David Malcolm
2015-09-25 16:36       ` Dodji Seketeli [this message]
2015-09-23 13:36 ` [PATCH 0/5] RFC: Overhaul of diagnostics (v2) Michael Matz
2015-09-23 13:43   ` Richard Biener
2015-09-23 13:53     ` Michael Matz
2015-09-23 15:51       ` Jeff Law
2015-09-24  2:39     ` David Malcolm
2015-09-24  9:03       ` Richard Biener
2015-09-25 16:50         ` Jeff Law
2015-10-13 15:33         ` Benchmarks of v2 (was Re: [PATCH 0/5] RFC: Overhaul of diagnostics (v2)) David Malcolm
2015-10-14  9:00           ` Richard Biener
2015-10-14 12:49             ` Michael Matz
2015-10-16 15:57             ` David Malcolm
2015-10-19 14:59               ` Michael Matz
2015-10-22 15:05                 ` David Malcolm
2015-11-13 16:02             ` David Malcolm
2015-10-23 20:25 ` [PATCH 00/10] Overhaul of diagnostics (v5) David Malcolm
2015-10-23 20:24   ` [PATCH 01/10] Improvements to description of source_location in line-map.h David Malcolm
2015-10-23 21:02     ` Jeff Law
2015-10-23 20:24   ` [PATCH 03/10] libstdc++v3: Explicitly disable carets and colorization within testsuite David Malcolm
2015-10-23 21:10     ` Jeff Law
2015-10-23 20:24   ` [PATCH 06/10] Track expression ranges in C frontend David Malcolm
2015-10-30  8:01     ` Jeff Law
2015-11-02 19:14       ` Status of rich location work (was Re: [PATCH 06/10] Track expression ranges in C frontend) David Malcolm
2015-11-02 19:53         ` David Malcolm
2015-11-02 22:26         ` Jeff Law
2015-11-06  7:12         ` Dodji Seketeli
2015-11-13 16:37         ` libcpp/C FE source range patch committed (r230331) David Malcolm
2015-10-23 20:25   ` [PATCH 04/10] Reimplement diagnostic_show_locus, introducing rich_location classes (v5) David Malcolm
2015-10-27 23:12     ` Jeff Law
2015-10-28 17:52       ` David Malcolm
2015-10-28 17:51         ` [PATCH 4b] diagnostic-show-locus.c changes: Insertions David Malcolm
2015-10-30  4:53           ` Jeff Law
2015-10-30 19:42             ` David Malcolm
2015-11-06 19:59             ` David Malcolm
2015-10-28 17:51         ` [PATCH 4a] diagnostic-show-locus.c changes: Deletions David Malcolm
2015-10-28 17:59         ` [PATCH 4c] Other changes: everything apart from diagnostic-show-locus.c changes David Malcolm
2015-10-30  4:49         ` [PATCH 04/10] Reimplement diagnostic_show_locus, introducing rich_location classes (v5) Jeff Law
2015-10-23 20:26   ` [PATCH 07/10] Add plugin to recursively dump the source-ranges in a tree (v2) David Malcolm
2015-10-27 21:32     ` Jeff Law
2015-10-23 20:26   ` [PATCH 08/10] Wire things up so that libcpp users get token underlines David Malcolm
2015-10-30  6:15     ` Jeff Law
2015-10-23 20:26   ` [PATCH 10/10] Compress short ranges into source_location David Malcolm
2015-10-30  6:07     ` Jeff Law
2015-11-04 20:42     ` Dodji Seketeli
2015-10-23 20:26   ` [PATCH 02/10] Add stats on adhoc table to dump_line_table_statistics David Malcolm
2015-10-23 21:07     ` Jeff Law
2015-10-23 20:26   ` [PATCH 05/10] Add ranges to libcpp tokens (via ad-hoc data, unoptimized) David Malcolm
2015-10-27 21:29     ` Jeff Law
2015-10-23 20:29   ` [PATCH 09/10] Delay some resolution of ad-hoc locations, preserving ranges David Malcolm
2015-10-27 22:15     ` Jeff Law
2015-10-23 21:25   ` [PATCH 00/10] Overhaul of diagnostics (v5) Jeff Law
2015-10-23 21:25     ` David Malcolm

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=86fv22lblm.fsf@seketeli.org \
    --to=dodji@seketeli.org \
    --cc=dmalcolm@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).