digitalmars.D.ldc - How can I add attributes to __asm statement?
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?
Nov 12 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.
Nov 12 2019
12.11.2019 21:20, kinke пишет: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.Thank you.
Nov 12 2019