From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11660 invoked by alias); 6 Dec 2006 23:39:05 -0000 Received: (qmail 11651 invoked by uid 22791); 6 Dec 2006 23:39:05 -0000 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 06 Dec 2006 23:38:59 +0000 Received: (qmail 30422 invoked from network); 6 Dec 2006 23:38:58 -0000 Received: from unknown (HELO localhost) (jimb@127.0.0.2) by mail.codesourcery.com with ESMTPA; 6 Dec 2006 23:38:58 -0000 To: "Ulrich Weigand" Cc: drow@false.org (Daniel Jacobowitz), gdb-patches@sourceware.org Subject: Re: [RFA][2/5] New port: Cell BE SPU (valops.c fix) References: <200612062316.kB6NG5Z9009161@d12av02.megacenter.de.ibm.com> From: Jim Blandy Date: Wed, 06 Dec 2006 23:39:00 -0000 In-Reply-To: <200612062316.kB6NG5Z9009161@d12av02.megacenter.de.ibm.com> (Ulrich Weigand's message of "Thu, 7 Dec 2006 00:16:05 +0100 (CET)") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00086.txt.bz2 "Ulrich Weigand" writes: >> I've got unsubmitted patches for GDB that implement a new kind of >> value, whose contents are read and written via functions provided by >> the user, based on a generic closure pointer. Future r2v / v2r >> functions could produce values of this sort, instead of using odd >> bitpos values. So the kludge wouldn't last forever. > > I'm not sure I see how this would solve the problem at hand: assume > r2v creates a value containing special functions to read and write > the register. Then common code goes and creates a value refering > to a sub-field of that value. How do we access that derived value? > Using the same access functions as provided for the full value -- > but how do they know they should operate only on a part (which part)? > It would appear that this is exactly the same problem as we're > currently discussing ... r2v would create a computed lvalue V whose closure indicates how the value is encoded in the register. V's contents are the decoded register contents. Common code goes and creates a value W referring to a sub-field of the value. W contains offset, bitpos and bitsize values indicating the sub-field's position within the decoded contents. When W is read, its 'read' function is called, which reads the register, does the decoding, and then extracts the appropriate portion. When W is assigned to, its 'write' function is called, which can do the appropriate decode-modify-encode steps, and write the re-encoded value back to the register. The key is that r2v knows how to both decode the register's contents, and how to re-encode both the full contents, or a portion of the contents, so it can leave enough information in the closure to tell v2r how to handle component writes.