Is DMD still not inlining "inline asm"?

max haughton maxhaton at gmail.com
Thu Nov 11 19:22:33 UTC 2021


On Thursday, 11 November 2021 at 17:29:33 UTC, rempas wrote:
> On Thursday, 11 November 2021 at 13:22:15 UTC, Basile B. wrote:
>>
>> 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.
>
> What? Not even GCC or Clang? Someone said that LDC2 does it 
> with two ways in the thread I linked

There's an attribute to tell it the function is safe to inline.


More information about the Digitalmars-d-learn mailing list