Is DMD still not inlining "inline asm"?

Basile B. b2.temp at gmx.com
Thu Nov 11 13:22:15 UTC 2021


On Thursday, 11 November 2021 at 08:58:43 UTC, rempas wrote:
> I've seen from 
> [this](https://forum.dlang.org/post/op.vrzngqeavxi10f@biotronic-laptop) reply in a thread from 2011 that DMD will not inline functions that contain inline assembly. Is this still the case?

Yes, this is still the case. A particularity of DMD inliner is 
that it does its job in the front-end, so inlining asm is totally 
impossible. Then, even if inlining was done in the backend 
inlining of asm would not be guaranteed because the byte code is 
generated at a very late stag, which causes problem with the 
registry allocator, the preservation of the stack, etc.

For example ldc2 does not inline a trival asm func 
https://godbolt.org/z/1W6r693Tq.

As for now, I know no compiler that can do that.


More information about the Digitalmars-d-learn mailing list