public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: "Will Newton" <will.newton@imgtec.com>
To: "Doug Evans" <dje@transmeta.com>
Cc: "Frank Ch. Eigler" <fche@redhat.com>, <cgen@sources.redhat.com>
Subject: RE: Constraints between operands
Date: Wed, 21 Sep 2005 16:03:00 -0000	[thread overview]
Message-ID: <0D107966AF6D79418315B7C5549F4B5104E01B@lemail1.le.imgtec.org> (raw)

 
> 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?

One thing that would seem useful is to be able to parse things easily
extending the existing infrastructure. I have come across two minor
instances where it could be useful to do this.

1. One of our addressing modes looks like this:

GETD  Reg1, [Reg2+#0x20++] ; Reg2+offset, post-increment Reg2

It is not possible to parse this using the builtin integer parser, it
barfs on the trailing ++. I implemented a parse handler for the integer
value and ended up using strtol, it would be nice if I could perhaps
pass an end pointer or length argument to cgen_parse_unsigned_integer to
tell it where to stop parsing and use that instead. Maybe this isn't
possible, it's not that big an issue.

2. To parse a register in a custom handler I ended up doing this:

  CGEN_OPERAND oper = meta_cgen_operand_table[opindex];
  int i;
  CGEN_KEYWORD *reg_names = NULL;

  for (i = 0; i < HW_MAX; i++)
    {
      if (meta_cgen_hw_table[i].type == oper.hw_type)
        {
          reg_names = (CGEN_KEYWORD *)meta_cgen_hw_table[i].asm_data;
        }
    }

  if (reg_names == NULL)
    return "internal error";

  errmsg = cgen_parse_keyword (cd, strp, reg_names, valuep);

Which is a little bit of a roundabout way to get something that perhaps
I should already have.

             reply	other threads:[~2005-09-21 16:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-21 16:03 Will Newton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-09-09  9:08 Will Newton
2005-09-21 15:39 ` Doug Evans
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=0D107966AF6D79418315B7C5549F4B5104E01B@lemail1.le.imgtec.org \
    --to=will.newton@imgtec.com \
    --cc=cgen@sources.redhat.com \
    --cc=dje@transmeta.com \
    --cc=fche@redhat.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).