inline asm in inlined function / ECX clobbered / stack frame / naked

kinke noone at nowhere.com
Wed May 29 09:45:37 UTC 2019


On Tuesday, 28 May 2019 at 20:45:35 UTC, James Blachly wrote:
> Thank you for your extensive work and detailed answers. I will 
> definitely take your advice and move to LLVM style inline asm.

You're welcome.

> Regarding my last unanswered(I think) question about why 
> LDC/LLVM was not saving ECX when inlining the naked function:
>
> since problem not evident when using the LLVM inline asm, this 
> is appears to be a bug related to combination of function 
> inlining and DMD style asm.

1. Your function wasn't naked ('essentially naked' != naked, 
there's a big difference; e.g., have a look at the LLVM IR).
2. Functions with DMD-style inline asm cannot be inlined 
(basically due to its lacking flexibility), and we normally bail 
out when applying `pragma(inline, true)`. You successfully 
circumvented that error by explicitly using 
`pragma(LDC_allow_inline)` (I can't think of a good use case for 
that pragma OTOH).


More information about the digitalmars-d-ldc mailing list