Gas error messages

Dave Brolley brolley@redhat.com
Wed Sep 14 13:59:00 GMT 2005


Will Newton wrote:

> 
>  
>
>The assembler I am writing supports a number of addressing modes,
>expressed like:
>
>GET    D0.0,[D0.1+D0.2] ; D0.0 <- mem[base(D0.1)+offset(D0.2)]
>GET    D0.0,[D0.1+#20]  ; D0.0 <- mem[base(D0.1)+offset(20)]
>
>I have specified these a separate instrucions, e.g.:
>
>(dni ...
>    "GET $DataReg1,[$DataReg2+$DataReg3]"
>    ...
>)
>(dni ...
>    "GET $DataReg1,[$DataReg2+#$Immed]"
>    ...
>)
>
>The immediate form is parsed by my custom parser, which returns it's
>error message. However, it seems that cgen goes on to attempt to parse
>the immediate as a register name, which fails with "unrecognized
>keyword". Is there a way to control this behaviour? Once I have hit the
>hash I would like to treat the value as always an immediate.
>  
>
This will happen once you finish implementing your parse function and it 
indicates "success" by returning NULL. Right now your parse function 
stub is indicating an error, so CGEN correctly attempts other parsing 
possibilities.

Another thing to consider is that CGEN will attempt to parse the insn 
variants in the order in which they appear in the .cpu file 
(undocumented but relied on by several existing ports). You should be 
able to get the behaviour you want by defining the immediate form of the 
insn last.

I hope this helps,
Dave




More information about the Cgen mailing list