public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: Mike Stump <mikestump@comcast.net>
Cc: Richard Guenther <rguenther@suse.de>,
	Jason Merrill <jason@redhat.com>,
		gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10))
Date: Sun, 12 Jun 2011 11:03:00 -0000	[thread overview]
Message-ID: <BANLkTik4-LvTKVrbB4iiremY8pJmK_++xg@mail.gmail.com> (raw)
In-Reply-To: <37B61697-B4A5-49B6-87C4-AD361A86F752@comcast.net>

On Sat, Jun 11, 2011 at 7:45 PM, Mike Stump <mikestump@comcast.net> wrote:
> On Jun 10, 2011, at 7:20 AM, Richard Guenther wrote:
>> On Fri, 10 Jun 2011, Jason Merrill wrote:
>>
>>> On 06/10/2011 10:03 AM, Richard Guenther wrote:
>>>>>> *((volatile int *)&a[0] + 1)
>>>>>
>>>>> It would be correct to fold it to
>>>>>
>>>>> VIEW_CONVERT_EXPR<volatile int,a[1]>
>>>>
>>>> No, it wouldn't be correct.  It isn't correct to fold it to an array-ref
>>>> that isn't volatile.
>>>
>>> Hmm?  The C expression produces a volatile int lvalue referring to the second
>>> element of a, as does the VIEW_CONVERT_EXPR.  They seem equivalent to me.
>>
>> no, a VIEW_CONVERT_EXPR is generally not an lvalue (fold for example
>> would turn the above to (volatile int) a[1]).
>
> Curious.  We have built up a built-in infrastructure that allows for lvalue register references.  I noticed that for vector types, vectors with different type names but the same in every other respect come out different, and a VIEW_CONVERT_EXPR is placed on it to get the types to match.  Presently I'm treating VIEW_CONVERT_EXPR as an lvalue.  For me not to, I'd need either for the same type to be used, or, for another conversion node to be used that can preserve the lvalueness of registers.
>
> Now, if people want to know why, lvalue for registers, it is to support in/out and output only parameters to built-ins.
>
> Thoughts?

In almost all cases(*) the need for a lvalue VIEW_CONVERT_EXPR can be avoided
by moving the VIEW_CONVERT_EXPR to the rvalue assigned too it.  Remember that
VIEW_CONVERT_EXPR always conver the full object and are not allowed to
change sizes.

So, do you have an example?

Richard.

(*) Ada uses lvalue component-refs on VIEW_CONVERT_EXPRs of aggregate types.
While I don't like it too much it's probably not too convenient (even
if it is always
possible) to move these to the RHS of assignments.

  reply	other threads:[~2011-06-12 10:56 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07  5:39 Jason Merrill
2011-06-07 10:20 ` Richard Guenther
2011-06-07 10:27   ` Jakub Jelinek
2011-06-07 12:03     ` Richard Guenther
2011-06-07 12:22       ` Richard Guenther
2011-06-07 13:46         ` Michael Matz
2011-06-07 13:49           ` Richard Guenther
2011-06-07 13:55   ` Jason Merrill
2011-06-07 14:05     ` Richard Guenther
2011-06-07 14:24       ` Jason Merrill
2011-06-09 19:47         ` Jason Merrill
2011-06-10  8:53           ` Richard Guenther
2011-06-10 14:03             ` Jason Merrill
2011-06-10 14:20               ` Richard Guenther
2011-06-10 14:32                 ` Jason Merrill
2011-06-10 14:34                   ` Richard Guenther
2011-06-10 14:45                     ` Jason Merrill
2011-06-11 18:24                     ` Mike Stump
2011-06-12 11:03                       ` Richard Guenther [this message]
2011-06-13  7:29                         ` Mike Stump
2011-06-13 12:46                           ` Richard Guenther
2011-06-14 20:31                             ` Mike Stump
2011-06-15  9:54                               ` Richard Guenther
2011-06-15 18:57                                 ` Mike Stump
2011-06-16  7:39                                   ` Richard Guenther
2011-06-17 14:17                                     ` Michael Matz
2011-06-20 10:24                                       ` Richard Guenther
2011-06-12  7:58                     ` Is VIEW_CONVERT_EXPR an lvalue? (was Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10))) Jason Merrill
2011-06-12 13:18                       ` Richard Guenther
2011-06-12 13:22                         ` Richard Guenther
2011-06-13  6:12                           ` Mike Stump
2011-06-12 22:42                         ` Jason Merrill
2011-06-13 12:44                           ` Richard Guenther
2011-06-13 17:59                             ` RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10)) Jason Merrill
2011-06-14  9:10                               ` Richard Guenther

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=BANLkTik4-LvTKVrbB4iiremY8pJmK_++xg@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=mikestump@comcast.net \
    --cc=rguenther@suse.de \
    /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).