public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Henderson <rth@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: Mark Mitchell <mark@codesourcery.com>, gcc@gcc.gnu.org
Subject: Re: [tree-ssa] Simplifying TARGET_EXPR
Date: Sun, 21 Jul 2002 00:41:00 -0000	[thread overview]
Message-ID: <20020720135854.C16252@redhat.com> (raw)
In-Reply-To: <wvly9c6ido9.fsf@prospero.cambridge.redhat.com>; from jason@redhat.com on Sat, Jul 20, 2002 at 05:09:42PM +0100

On Sat, Jul 20, 2002 at 05:09:42PM +0100, Jason Merrill wrote:
> 2) Passing a TARGET_EXPR to a call means initializing the temporary on the
>    stack and passing its address to the call.  There's no way to express
>    this in a simplified form; if we replace the TARGET_EXPR with the
>    variable it initializes, expand_call will make a bitwise copy, which is
>    wrong.  I can think of two solutions to this:
> 
>    a) Change expand_call to not copy variables with DECL_ARTIFICIAL set.
>    b) Pass an ADDR_EXPR of the variable instead, and change expand_call
>       to handle that case.
> 
>    My preference is for (b), as (a) might have unintended consequences.
[...]
> One problem with (b) is that using it requires the frontend to know about
> passing by invisible reference.  However, in the cases where we pass by
> invisible reference because TREE_ADDRESSABLE is set on the type, it's
> already controlled by the frontend, so that doesn't seem like a big issue.
> For cases where we would pass by invisiref for other reasons, doing a
> bitwise copy is just inefficient, and we could leave it up to the optimizer
> to fix that up.

(a) is definitely scary.

(b) doesn't seem quite right since the type of the argument doesn't
match up with the type actually passed.  Seems like we'd get into
trouble with the backends wrt FUNCTION_ARG et al.

Given that the front end has to know about the semantics of copying
objects and how that affects parameter passing anyway, perhaps the
front end should modify the type of the parameter at the same time.
Perhaps a REFERENCE_TYPE with DECL_ARTIFICIAL set?  Then an ADDR_EXPR
would match up nicely.


r~

  reply	other threads:[~2002-07-20 20:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-20 18:54 Jason Merrill
2002-07-21  0:41 ` Richard Henderson [this message]
2002-07-26 14:51   ` PATCH " Jason Merrill
2002-07-21 17:32 ` [tree-ssa] " Mark Mitchell
2002-07-21 18:04   ` Gabriel Dos Reis
2002-07-21 18:14     ` Mark Mitchell
2002-07-21 20:39       ` Gabriel Dos Reis
2002-07-22  8:32         ` Michael Matz
2002-07-22 12:02           ` Gabriel Dos Reis
2002-07-24  3:22           ` Mark Mitchell
2002-07-22 12:33       ` Nathan Sidwell
2002-07-22 12:53         ` Gabriel Dos Reis
2002-07-22 13:10         ` Jason Merrill
2002-07-21 22:35   ` Jason Merrill
  -- strict thread matches above, loose matches on Subject: below --
2002-07-16  9:52 Jason Merrill

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=20020720135854.C16252@redhat.com \
    --to=rth@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=mark@codesourcery.com \
    /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).