This is the mail archive of the
cgen@sources.redhat.com
mailing list for the CGEN project.
Re: escaping in syntax strings
Yes -- see the fr30 for an example of this:
h-r13 -- hardware element
R13 -- special operand
r13base-ld -- pmacro for generating insns which have r13 hardwired but
still specified
Dave
Frank Ch. Eigler wrote:
> I wrote:
>
> : [...]
> : By the way, why do you need a "$" in the syntax string? Are you
> : confusing register name keywords or hexadecimal constants with
> : the markers that actually belong into the syntax strings?
>
> I just found what Ben was talking about. It seems that some
> instructions in the assembly language for his target includes dummy
> operands that make explicit the implicit (not-encoded) operands. For
> example, given a register keyword set such as "$0 .. $7", there are
> some instructions which are hard-wired to use only $0 as an input or
> output, in addition to other inputs/outputs. Rather than leave the $0
> implicit, this assembly language expects the programmer to specify it.
> Say,
> compare $0,$2,$3
> instead of
> compare $2,$3
>
> So, Ben is trying to implement this in the assembler by including the
> literal string "$0" in the syntax bytes of the instruction. This is
> not too bad, though a possibly better way would be to associate a
> synthetic cgen operand with that slot, and to give it a parser that
> accepts only "$0", and emits a helpful error message for anything
> else.
>
> - FChE
>
>