3 ms·
The inline asm syntax was designed to match the Intel asm documentation. A hidden feature of the D inline assembler is the compiler knows which registers are r
by WalterBright 3y ago
The inline asm syntax was designed to match the Intel asm documentation.
A hidden feature of the D inline assembler is the compiler knows which registers are read/written, so there's no need for the programmer to explicitly specify it. The compiler will also figure out the right addressing mode for local variables, so the programmer is relieved of that, too.
- JonChesterfield 3y agoDeriving the read/write behaviour from the instruction definition is so far superior to the gcc approach that I wonder how we ended up here. That is a very good call by the D toolchain.
- WalterBright 3y agoIt's a small investment into the compiler to add it, and a large payoff for the user to not have bugs from manually doing it. I proposed doing the same for printf - have the compiler example the arguments and insert the appropriate formats in the format string.