public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: [tree-ssa] Simplifying TARGET_EXPR
@ 2002-07-20 18:54 Jason Merrill
  2002-07-21  0:41 ` Richard Henderson
  2002-07-21 17:32 ` [tree-ssa] " Mark Mitchell
  0 siblings, 2 replies; 15+ messages in thread
From: Jason Merrill @ 2002-07-20 18:54 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: Richard Henderson, gcc, Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 594 bytes --]

I'm interested in what y'all think about the second issue; it's something
I've run into previously when thinking about expanding NEW_EXPR.

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.


[-- Attachment #2: Type: message/rfc822, Size: 793 bytes --]

From: Jason Merrill <jason@redhat.com>
To: gcc@gcc.gnu.org
Subject: [tree-ssa] Simplifying TARGET_EXPR
Date: Tue, 16 Jul 2002 11:02:01 +0100

[snip]

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.

Thoughts?

Jason

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [tree-ssa] Simplifying TARGET_EXPR
@ 2002-07-16  9:52 Jason Merrill
  0 siblings, 0 replies; 15+ messages in thread
From: Jason Merrill @ 2002-07-16  9:52 UTC (permalink / raw)
  To: gcc

Thinking about simplifying TARGET_EXPR, I see two issues to be dealt with:

1) expand_expr's treatment of TARGET_EXPR depends on whether or not it is
   being expanded with a target: if so, it initializes the target object;
   if not, it initializes a new object.  There's no way to model that
   behavior with the current simplification code, as there's no concept
   of 'target'.

   However, I think that the copy-elision should only occur under an
   INIT_EXPR, so we can check for TARGET_EXPR in simplify_modify_expr.
   This should work fine.

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.

Thoughts?

Jason

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2002-07-26 10:04 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-20 18:54 [tree-ssa] Simplifying TARGET_EXPR Jason Merrill
2002-07-21  0:41 ` Richard Henderson
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

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).