Assembler syntax with embedded spaces

View: New views
4 Messages — Rating Filter:   Alert me  

Assembler syntax with embedded spaces

by Will Newton-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Hi all,

Is it possible to use CGEN to generate an assembler/disassembler for an
assembler syntax with whitespace embedded in mnemonics, e.g.:

FD ABS FX.0,FX.1

Where "FD ABS" is the mnemonic (ABS) plus a prefix (FD). Currently my
assembler says:

unrecognized form of instruction `fd ABS FX.0,FX.1'

Thanks,
-
This message is subject to Imagination Technologies' e-mail terms: http://www.imgtec.com/e-mail.htm
-


Re: Assembler syntax with embedded spaces

by Dave Brolley-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

CGEN will likely have problems with a prefix containing whitespace, i.e.
'fd '. You will probably have to code 2 versions of the insn(s), one
with the prefix and one without. pmacros may be useful for you here in
order to reduce duplicate typing.

I hope this helps,
Dave

Will Newton wrote:

>Hi all,
>
>
>
>Is it possible to use CGEN to generate an assembler/disassembler for an
>
>assembler syntax with whitespace embedded in mnemonics, e.g.:
>
>
>
>FD ABS FX.0,FX.1
>
>
>
>Where "FD ABS" is the mnemonic (ABS) plus a prefix (FD). Currently my
>
>assembler says:
>
>
>
>unrecognized form of instruction `fd ABS FX.0,FX.1'
>
>
>
>Thanks,
>
>-
>
>This message is subject to Imagination Technologies' e-mail terms: http://www.imgtec.com/e-mail.htm
>
>-
>
>
>  
>


Re: Assembler syntax with embedded spaces

by Will Newton-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Jan 8, 2008 3:32 PM, Dave Brolley <brolley@...> wrote:
> CGEN will likely have problems with a prefix containing whitespace, i.e.
> 'fd '. You will probably have to code 2 versions of the insn(s), one
> with the prefix and one without. pmacros may be useful for you here in
> order to reduce duplicate typing.

I've just had a dig in the cgen source and noticed this comment in insn.scm:

; Return instruction mnemonic.
; This is computed from the syntax string.
; The mnemonic, as we define it, is everything up to, but not including, the
; first space or '$'.
; FIXME: Rename to syntax-mnemonic, and take a syntax string argument.

and opc-itab.scm:

; Strip the mnemonic part from SYNTAX.
; (ie: everything up to but not including the first space or '$')
; If STRIP-MNEM-OPERANDS?, strip them too.

I'm not sure what I want to do is possible.

Re: Assembler syntax with embedded spaces

by Dave Brolley-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Will Newton wrote:

>I've just had a dig in the cgen source and noticed this comment in insn.scm:
>
>; Return instruction mnemonic.
>; This is computed from the syntax string.
>; The mnemonic, as we define it, is everything up to, but not including, the
>; first space or '$'.
>; FIXME: Rename to syntax-mnemonic, and take a syntax string argument.
>
>and opc-itab.scm:
>
>; Strip the mnemonic part from SYNTAX.
>; (ie: everything up to but not including the first space or '$')
>; If STRIP-MNEM-OPERANDS?, strip them too.
>
>I'm not sure what I want to do is possible.
>  
>
It certainly seems that CGEN is not well suited to the assembly syntax.
Two solutions:

1) Implement the FIXME described above
2) (ugly hack) treat the prefix as the mnemonic and the mnemonics as
operands.

Dave


LightInTheBox - Buy quality products at wholesale price!