5 ms·
> D's inline assembly DSL only works in x86 and x86-64. You're conflating DMD (the reference compiler) with the language here. LDC and GDC (the LLVM and GCC ba
by nicwilson 5y ago
> D's inline assembly DSL only works in x86 and x86-64.
You're conflating DMD (the reference compiler) with the language here. LDC and GDC (the LLVM and GCC based D compilers) both support GCC style "extended" inline assembly[0] and LDC even allows you to write inline LLVM IR.
[0]: https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html
- WalterBright 5y agoYou're quite right, the D language leaves the inline assembler as implementation defined. DMD has a quite nice assembler that was lifted and updated from the older Digital Mars C++ inline assembler. Each of the D compilers supports inline assembler for each of the targets the particular compiler supports.
- lifthrasiir 5y agoI might not have been clear (sorry!) but the DSL here refers to the integrated assembly syntax as opposed to LLVM/GCC's textual approaches. Both syntaxes are officially documented in the D Language Reference [1], which is arguably the specification for D the language, but since DMD came much earlier than other implementations, I think it's fair to consider the DSL to be designed alongside with D. Anyway LDC and GCD's inability to support the DSL strengthens my original point. [1] https://dlang.org/spec/iasm.html https://dlang.org/spec/iasm.html
- mhh__ 5y agoLDC also supports most of the extended inline asm. GDC used to support it (long story but that code is now the LDC impl), but it was removed a long time ago. GDC isn't that much younger than dmd.