Testers required for tool for LDC - asm_parse
Cecil Ward
cecil at cecilward.com
Thu Jul 6 19:38:20 UTC 2023
I have written a tool that transforms a GDC-style (advanced-type
?) inline asm fragment of D, an "asm { }" statement, into a form
that LDC can understand even when it contains named variables in
the asm.
This could either be used with LDC to transform your advanced
friendly asm so LDC will accept it, or if anyone is really
interested I suppose that it could be integrated into LDC if
desired, as that would save the LDC developers some work.
It’s a hand-written recursive descent parser for a partial D
grammar, only the minimal bits that are necessary to get the job
done and I’ll admit that it’s a bit of a hack and the code is
still untidy.
It has only received minimal testing, and needs other test input,
that is little asm statements’ text. It also needs ill-formed
input, just to make sure that the parser doesn’t go into an
infinite loop anywhere. It doesn’t do diagnostic error messages,
intentionally omitted for several good reasons, if faced with
syntactically incorrect ie. ill-formed input.
It is a single D file of about 80k, 2k loc. Internally it uses my
‘likely’/‘unlikely’ technology taken from GCC to boost
performance of conditional jumps. This may not work under LDC,
hasn’t been tested enough, but not working means not giving the
expected performance improvement, not that it will make the
program’s functioning incorrect.
More information about the digitalmars-d-ldc
mailing list