From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21303 invoked by alias); 20 Jul 2002 20:58:54 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 21296 invoked from network); 20 Jul 2002 20:58:54 -0000 Received: from unknown (HELO potter.sfbay.redhat.com) (205.180.83.107) by sources.redhat.com with SMTP; 20 Jul 2002 20:58:54 -0000 Received: from dot.sfbay.redhat.com (dot.sfbay.redhat.com [172.16.24.7]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id g6KKxLQ08180; Sat, 20 Jul 2002 13:59:21 -0700 Received: (from rth@localhost) by dot.sfbay.redhat.com (8.11.6/8.11.6) id g6KKwsM16269; Sat, 20 Jul 2002 13:58:54 -0700 X-Authentication-Warning: dot.sfbay.redhat.com: rth set sender to rth@redhat.com using -f Date: Sun, 21 Jul 2002 00:41:00 -0000 From: Richard Henderson To: Jason Merrill Cc: Mark Mitchell , gcc@gcc.gnu.org Subject: Re: [tree-ssa] Simplifying TARGET_EXPR Message-ID: <20020720135854.C16252@redhat.com> Mail-Followup-To: Richard Henderson , Jason Merrill , Mark Mitchell , gcc@gcc.gnu.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: ; from jason@redhat.com on Sat, Jul 20, 2002 at 05:09:42PM +0100 X-SW-Source: 2002-07/txt/msg00917.txt.bz2 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~