Inter-compiler portability of asm between gdc and ldc2 (and dmd)

IGotD- nise at nise.com
Sat Oct 3 22:33:03 UTC 2020


On Saturday, 3 October 2020 at 13:27:23 UTC, kinke wrote:
>
> Yeah sure. See 
> https://github.com/ldc-developers/ldc/blob/master/gen/asm-x86.h 
> for an incomplete x86 implementation. And now imagine something 
> like this for every ISA supported by GCC and LLVM, and keeping 
> it up-to-date. - The whole point of the GCC/GDC-style assembly 
> is genericity - an instructions template provided by the user 
> as a string to be forwarded to the assembler (opaque for the 
> optimizer), and outputs/inputs/clobbers provided separately 
> because that's the only thing the pre-assembler stages need to 
> know.
>
> Considering inline asm is mostly used as a last resort for some 
> very low-level stuff, extending the front-end by a full-blown 
> parser for every ISA would be an absolutely improportionate 
> effort.

One thing that has puzzled me for some time with the GCC syntax 
is the necessity to include the clobber information. Can't that 
process be automated, for example the assembler returns 
information to the compiler about this?


More information about the Digitalmars-d mailing list