From: Richard Biener <richard.guenther@gmail.com>
To: Pierrick Philippe <pierrick.philippe@irisa.fr>
Cc: gcc@gcc.gnu.org
Subject: Re: [gimple-ssa] result_decl and ssa_name
Date: Fri, 5 Apr 2024 14:46:48 +0200 [thread overview]
Message-ID: <CAFiYyc1=SM0O9J4WH62p6yGw8iqVtN_3Nf7wA+agsH7HNmj5bA@mail.gmail.com> (raw)
In-Reply-To: <7b63c4ff-b32e-44ad-9b25-3f8f2d138056@irisa.fr>
On Fri, Apr 5, 2024 at 1:59 PM Pierrick Philippe
<pierrick.philippe@irisa.fr> wrote:
>
> Hi all,
>
> I do have a question regarding ssa_name and result_decl.
>
> For example on the following gimple function:
>
> int f ()
> {
> int x;
> int D.2747;
> int _2;
>
> <bb 2> :
> x_1 = 42;
> _2 = x_1;
>
> <bb 3> :
> <L0>:
> return _2;
>
> }
>
> On the above example, using the macro SSA_NAME_VAR() on _2 does not
> yield anything usable.
> Neither to call ssa_default_def() on the result of the result_decl
> obtain through macro DECL_RESULT().
>
> Is there a way to get the ssa_name corresponding to the result_decl of a
> function obtained through the use of macro DECL_RESULT() on a fn_decl?
> And/or the other way around? I.e., from the returned ssa_name of a
> function to the result_decl of that function?
>
> I totally might be missing something here, but I cannot figure out what.
DECL_RESULT isn't always used (as in your example). Not all SSA names
have corresponding declarations, we have "anonymous" SSA names which
have a NULL_TREE SSA_NAME_VAR (such as the _2 in your example).
What do you try to find in the end? If you want to find all returns you can
walk predecessors of EXIT_BLOCK and look at their last stmt whether they
are greturn statements.
Richard.
> Thanks for your time,
>
> Pierrick
>
next prev parent reply other threads:[~2024-04-05 12:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 11:58 Pierrick Philippe
2024-04-05 12:46 ` Richard Biener [this message]
2024-04-05 13:44 ` Pierrick Philippe
2024-04-06 12:53 ` Richard Biener
2024-04-08 8:47 ` Pierrick Philippe
2024-04-08 9:02 ` Richard Biener
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='CAFiYyc1=SM0O9J4WH62p6yGw8iqVtN_3Nf7wA+agsH7HNmj5bA@mail.gmail.com' \
--to=richard.guenther@gmail.com \
--cc=gcc@gcc.gnu.org \
--cc=pierrick.philippe@irisa.fr \
/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).