From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32104 invoked by alias); 31 Mar 2004 16:49:50 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 32036 invoked from network); 31 Mar 2004 16:49:47 -0000 Received: from unknown (HELO localhost.redhat.com) (216.129.200.20) by sources.redhat.com with SMTP; 31 Mar 2004 16:49:47 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 6024A2B92; Wed, 31 Mar 2004 11:49:50 -0500 (EST) Message-ID: <406AF6AE.5040106@gnu.org> Date: Wed, 31 Mar 2004 16:49:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040217 MIME-Version: 1.0 To: Daniel Jacobowitz Cc: Paul Hilfinger , gdb-patches@sources.redhat.com Subject: Re: [RFA] Add language-dependent post-parser References: <20040330092413.2E716F281D@nile.gnat.com> <20040330142656.GA18340@nevyn.them.org> <20040331080245.C139FF2B8B@nile.gnat.com> <20040331153004.GA29623@nevyn.them.org> <20040331153650.GA30084@nevyn.them.org> In-Reply-To: <20040331153650.GA30084@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03/txt/msg00762.txt.bz2 >>>>> > > I don't see why you can't do it, for instance, here: >>>>> > > simple_exp : simple_exp '(' arglist ')' >>>>> > > { >>>>> > > write_exp_elt_opcode (OP_FUNCALL); >>>>> > > write_exp_elt_longcst ($3); >>>>> > > /* check arguments */ >>>>> > > write_exp_elt_opcode (OP_FUNCALL); >>>>> > > } >>>>> > > ; >>> >>>> > >>> >>>>> > > You'd have to wiggle the expression machinery to give you back the >>>>> > > expression node for the function name, probably by making the >>>>> > > write_exp_* functions return a pointer. But that's less intrusive and >>>>> > > more efficient than adding a second pass. >>> >>>> > >>>> > Yes, that's exactly how I'd LIKE to do it. And I would, but for one >>>> > miserable little fact: the expression at this point is in POSTFIX >>>> > form. So, for example, I can't use evaluate_type or the evaluate_exp >>>> > member of exp_descriptor, both of which work on PREFIX form. >> >>> >>> How much work would it be to duplicate and prefixify them, then? >>> prefixify_subexp has the right interface already; if you write out the >>> OP_FUNCALL, you could then call a function which returns a new struct >>> expression in prefix form containing just the call and its arguments. >>> It would just need to allocate enough memory (could be generous about >>> it and just use the size of the original expression), call >>> prefixify_subexp, and fiddle out->nelts. >>> >>> OK, it's not so _efficient_, but... it could be made efficient if >>> someone overhauls the representation at some point. > > > But I guess the point is, this is no more elegant than a second pass, > and whatever you implement I should probably use for C++ anyway so it > won't be an Ada-specific hook. Does anyone else have an opinion? Ok, two thoughts: - how come it's in this compressed postfix form? This could hardly be a memory usage problem? - could multi-pass be better / cleaner long term? Is there a language (that we care about) with overload semantics so screwed up that both the containing expression and the parameters are needed when resolving the name? One way to get an answer is to ask: how to the corresponding compilers (Ada, Java, ObjC, C++) all implement this? Andrew