How can I add attributes to __asm statement?
kinke
kinke at gmx.net
Tue Nov 12 18:20:17 UTC 2019
On Tuesday, 12 November 2019 at 16:33:28 UTC, drug wrote:
> In gdc I can use the following:
> ```
> asm @nogc @safe nothrow pure {
> ...
> }
> ```
> but it doesn't work in case of ldc2. I can use a lambda:
> ```
> () @nogc @trusted nothrow pure {
> __asm (...)
> }
> ```
> but the lambda is inlined only in release mode. Additional
> stack frame or using only release mode is not convenient in my
> case. Is there another way to add attributes to __asm statement?
LDC's `__asm` is not a statement, but a special function. It's
already `pure nothrow @nogc`; if you want to call it in a @safe
function, use `__asm_trusted` instead. See
https://github.com/ldc-developers/druntime/blob/ldc/src/ldc/llvmasm.di.
More information about the digitalmars-d-ldc
mailing list