From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16083 invoked by alias); 9 Sep 2005 09:08:56 -0000 Mailing-List: contact cgen-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sources.redhat.com Received: (qmail 15427 invoked by uid 22791); 9 Sep 2005 09:08:28 -0000 Received: from multi.imgtec.com (HELO multi.imgtec.com) (194.200.65.239) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 09 Sep 2005 09:08:28 +0000 X-SEF-Processed: 5_0_0_812__2005_09_09_10_08_18 Received: from Unknown [192.168.5.239] by multi.imgtec.com - SurfControl E-mail Filter (5.0); Fri, 09 Sep 2005 10:08:18 +0100 Received: from lemail1.le.imgtec.org ([192.168.152.65]) by klmail1.kl.imgtec.org with Microsoft SMTPSVC(6.0.3790.1830); Fri, 9 Sep 2005 10:08:18 +0100 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Constraints between operands Date: Fri, 09 Sep 2005 09:08:00 -0000 Message-ID: <0D107966AF6D79418315B7C5549F4B5104DFDF@lemail1.le.imgtec.org> From: "Will Newton" To: "Frank Ch. Eigler" Cc: X-SW-Source: 2005-q3/txt/msg00021.txt.bz2 > > [...] > > I'm using cgen to write a binutils port for a processor. I've come=20 > > across a problem I haven't been able to solve yet with expressing a=20 > > constraint between a number of fields in an instruction. > > [...] > > ADD D0.1,D0.2 ; Data unit 0 for both regs, OK ADD D0.1,D1.2 ; Data=20 > > unit mismatch, error! > > [...] >=20 > One way may be to write a custom operand parser for the=20 > second D slot, which would enforce this constraint. It would=20 > signal a parse error. I could not see an easy way to reference a previous field. The prototype of parse handlers is like: static const char * parse_hi16 (cd, strp, opindex, valuep) CGEN_CPU_DESC cd; /* CPU description */ const char **strp; /* Current position in input text */ int opindex; /* ??? */ unsigned long *valuep; /* Result */ In order to find what the previous operand's data unit was the only way I can see is to rewind strp and parse the input text, which may or may not work and seems quite nasty. Or is there an easier way?