From: Richard Biener <richard.guenther@gmail.com>
To: Alexander Monakov <amonakov@ispras.ru>
Cc: gcc@gcc.gnu.org
Subject: Re: NOP_EXPR vs. CONVERT_EXPR
Date: Tue, 5 Dec 2023 15:53:44 +0100 [thread overview]
Message-ID: <CAFiYyc1_81qL9ruzHzTauELd1izxHUYfJuX36mMDf-UvEXeFNg@mail.gmail.com> (raw)
In-Reply-To: <b086f5d0-a8c3-febf-e043-432c0e1065d5@ispras.ru>
On Tue, Dec 5, 2023 at 3:54 PM Alexander Monakov via Gcc
<gcc@gcc.gnu.org> wrote:
>
> Greetings,
>
> the definitions for NOP_EXPR and CONVERT_EXPR in tree.def, having survived
> all the way from 1992, currently say:
>
> /* Represents a conversion of type of a value.
> All conversions, including implicit ones, must be
> represented by CONVERT_EXPR or NOP_EXPR nodes. */
> DEFTREECODE (CONVERT_EXPR, "convert_expr", tcc_unary, 1)
>
> /* Represents a conversion expected to require no code to be generated. */
> DEFTREECODE (NOP_EXPR, "nop_expr", tcc_unary, 1)
>
> Unfortunately, they are confusing, as in
>
> float f(double d)
> {
> return d;
> }
>
> the narrowing conversion is represented with NOP_EXPR, and it is definitely
> not a no-op.
>
> Does some clear distinction remain, and is it possible to clarify the
> definitions?
{NOP,CONVERT}_EXPR are interchangeable in the middle-end but
frontends (IIRC the C++ FE mainly) distinguishes them. So a uniform
documentation might be difficult - in the end we could eventually
drop NOP_EXPR from the middle-end (during gimplification?) and
only use CONVERT_EXPR. All uses should use CASE_CONVERT
or CONVERT_EXPR_CODE_P which globs both.
Richard.
>
> Thanks.
> Alexander
next prev parent reply other threads:[~2023-12-05 14:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-05 14:52 Alexander Monakov
2023-12-05 14:53 ` Richard Biener [this message]
2023-12-08 0:24 ` Jeff Law
2023-12-08 6:51 ` 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_81qL9ruzHzTauELd1izxHUYfJuX36mMDf-UvEXeFNg@mail.gmail.com \
--to=richard.guenther@gmail.com \
--cc=amonakov@ispras.ru \
--cc=gcc@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).