This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
RE: Constraints between operands
- From: "Will Newton" <will dot newton at imgtec dot com>
- To: "Doug Evans" <dje at transmeta dot com>
- Cc: "Frank Ch. Eigler" <fche at redhat dot com>,<cgen at sources dot redhat dot com>
- Date: Wed, 21 Sep 2005 17:02:36 +0100
- Subject: RE: Constraints between operands
> 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.