From: Doug Evans <dje@transmeta.com>
To: "Will Newton" <will.newton@imgtec.com>
Cc: "Frank Ch. Eigler" <fche@redhat.com>, <cgen@sources.redhat.com>
Subject: RE: Constraints between operands
Date: Wed, 21 Sep 2005 15:39:00 -0000 [thread overview]
Message-ID: <17201.32412.843359.538250@casey.transmeta.com> (raw)
In-Reply-To: <0D107966AF6D79418315B7C5549F4B5104DFDF@lemail1.le.imgtec.org>
Will Newton writes:
>
> > > [...]
> > > I'm using cgen to write a binutils port for a processor. I've come
> > > across a problem I haven't been able to solve yet with expressing a
> > > 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
> > > unit mismatch, error!
> > > [...]
> >
> > One way may be to write a custom operand parser for the
> > second D slot, which would enforce this constraint. It would
> > signal a parse error.
Another alternative I've seen is to specify a special operand at the
end whose sole purpose is to validate the insn. It's at the end so it
has a view of the entire insn.
> 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?
I was going to say have either a special "parse" or "insert" handler.
I seem to recall other instances where I needed to validate two
operands against each other, but I can't find one at the moment.
At any rate, you're right, the parse handler isn't passed sufficient info.
If I can't find an existing example I think we need to extend cgen.
e.g. pass the fields struct to either or both of the parse and insert
handlers.
Comments folks?
next prev parent reply other threads:[~2005-09-21 15:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-09 9:08 Will Newton
2005-09-21 15:39 ` Doug Evans [this message]
-- strict thread matches above, loose matches on Subject: below --
2005-09-21 16:03 Will Newton
2005-09-08 13:56 Will Newton
2005-09-08 20:28 ` Frank Ch. Eigler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=17201.32412.843359.538250@casey.transmeta.com \
--to=dje@transmeta.com \
--cc=cgen@sources.redhat.com \
--cc=fche@redhat.com \
--cc=will.newton@imgtec.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).