public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Erick Ochoa <eochoa@gcc.gnu.org>
Cc: Jan Hubicka <hubicka@ucw.cz>, GCC Development <gcc@gcc.gnu.org>
Subject: Re: tree decl stored during LGEN does not map to a symtab_node during WPA
Date: Tue, 13 Jul 2021 14:55:12 +0200	[thread overview]
Message-ID: <CAFiYyc23ekuBco6nN7aOBWpAxSSbmG8LWsMS=Ouhx8v5b69wqg@mail.gmail.com> (raw)
In-Reply-To: <CAJ_nqzh8rMx=8Dy7uWdZU8DT7F1E6yzb3B7ZjT+i_sd1EoKHxw@mail.gmail.com>

On Tue, Jul 13, 2021 at 12:50 PM Erick Ochoa <eochoa@gcc.gnu.org> wrote:
>
> > There are entities, like SSA names and STRING_CSTs which are specially
> > encoded and if you stream those in your LGEN data you have to set up
> > appropriate encoders.  In general streaming arbitrary trees isn't the
> > best thing to do, usually you're interested in specific pieces only.  That's
> > especially true for things "local" to a function (like SSA names), I think
> > existing IPA passes only stream encoded references to global entities
> > (or parameters) and all "local" info is some pass specific data streamed
> > as raw data, not trees.
>
> Thanks!
>
> >
> > Why do you want to stream SSA trees for example?
> >
>
> I am working on a prototype for a points-to analysis where the
> implementation is an IPA_PASS as opposed to a SIMPLE_IPA_PASS. It is
> still somewhat early in the prototype implementation stages but I
> would like to have SSA trees at WPA time as a way to map constraints
> variables back to Gimple. The idea is to generate most constraints at
> LGEN time (some will have to be updated) and solve them at WPA time.
>
> Do you have any other suggestions on how to map constraint variables
> (similar to the index in the varinfo_t array) back to Gimple (but now
> as an IPA_PASS)? We have had similar discussions before, but now I am
> looking at things more concretely, from the point of view of: how
> exactly does one map the analysis back to Gimple while staying within
> what is possible in the LTO framework?

I guess the way to encode SSA trees would be to use sth like a
<function-encoder>, SSA-version tuple much like PTA internally
uses the varinfo array index as identifier for the variables in the
constraints.  For local decls (as opposed to SSA names) it's a bit
more difficult - you'd have to devise your own encoding here.

What you can rely on I think is that for local variables UID relations
are preserved, so you could sort cfun->local_decls and use the
position in this array as encoding (in fact I see local_decls is
streamed literally, so you don't even need to sort that for the
start - but we could likely do that without harm to make searching
for a UID O(log n)).

> I do have a pass-specific data structure, but it contains references
> to trees. It is similar to varinfo_t, which has a decl. I also have
> another tree for expressions (the concrete use case right now is
> having a global variable being assigned to a string literal), and a
> field for ssa variables, which was intended to store a reference to
> the corresponding tree. Again, as a way to map back the constraint
> variable to Gimple.
>
> > There can be no
> > references to those from other IPA entities?
>
> I don't follow this question. I think this may be a statement and not
> a question. Please clarify this for me, but perhaps the following
> might answer: Since I am working on an interprocedural analysis, SSA
> variables may point to abstract memory locations allocated in
> different functions. So I need to have a link between SSA variables
> and whatever memory locations they might point to.

So as said above - you need to devise your own "encoder" then
and at WPA time hopefully not need to look at the actual trees
but can treat them as opaque entities, only mapping back the
result at LTRANS time (and only for the interesting functions / globals).

Richard.

  reply	other threads:[~2021-07-13 12:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07  9:27 Erick Ochoa
2021-07-09  7:51 ` Erick Ochoa
2021-07-09  9:49   ` Richard Biener
2021-07-12 10:55     ` Erick Ochoa
2021-07-13  9:21       ` Erick Ochoa
2021-07-13  9:41         ` Richard Biener
2021-07-13 10:49           ` Erick Ochoa
2021-07-13 12:55             ` Richard Biener [this message]
2021-07-14 13:56               ` Erick Ochoa
2021-07-15  7:23                 ` Richard Biener
2021-07-21 16:55                   ` Erick Ochoa
2021-07-22 11:40                     ` Richard Biener
2021-07-22 12:04                       ` Erick Ochoa
2021-07-22 12:08                         ` Erick Ochoa
2021-07-22 12:23                         ` Richard Biener
2021-07-22 12:33                           ` Erick Ochoa
2021-07-22 12:48                             ` Richard Biener
2021-07-22 14:32                               ` Erick Ochoa
2021-07-28 10:35                                 ` Richard Biener
2021-07-13 11:56           ` Erick Ochoa

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='CAFiYyc23ekuBco6nN7aOBWpAxSSbmG8LWsMS=Ouhx8v5b69wqg@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=eochoa@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=hubicka@ucw.cz \
    /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).