From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3214 invoked by alias); 31 Mar 2004 15:30:07 -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 3128 invoked from network); 31 Mar 2004 15:30:04 -0000 Received: from unknown (HELO nevyn.them.org) (66.93.172.17) by sources.redhat.com with SMTP; 31 Mar 2004 15:30:04 -0000 Received: from drow by nevyn.them.org with local (Exim 4.30 #1 (Debian)) id 1B8hfJ-0007lf-0B; Wed, 31 Mar 2004 10:30:05 -0500 Date: Wed, 31 Mar 2004 15:30:00 -0000 From: Daniel Jacobowitz To: Paul Hilfinger Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] Add language-dependent post-parser Message-ID: <20040331153004.GA29623@nevyn.them.org> Mail-Followup-To: Paul Hilfinger , gdb-patches@sources.redhat.com References: <20040330092413.2E716F281D@nile.gnat.com> <20040330142656.GA18340@nevyn.them.org> <20040331080245.C139FF2B8B@nile.gnat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040331080245.C139FF2B8B@nile.gnat.com> User-Agent: Mutt/1.5.1i X-SW-Source: 2004-03/txt/msg00755.txt.bz2 On Wed, Mar 31, 2004 at 03:02:45AM -0500, Paul Hilfinger wrote: > > Daniel, > > > 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. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer