This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] Simplifying TARGET_EXPR


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]