Access 'this' in inline assembly
bearophile
bearophileHUGS at lycos.com
Tue Mar 8 00:28:49 PST 2011
Brad Roberts:
>It's not by design. It's a quality of implementation issue that's solvable given some time to work on it. I intend to, eventually, unless someone has gotten to it ahead of me.<
Good, I am glad to be wrong then.
Currently in LDC you have two different ways to tell the compiler to inline some Asm. Such syntaxes are not present in D/DMD. So do you plan to add something like those two syntaxes to D/DMD too?
One of them is this pragma:
http://www.dsource.org/projects/ldc/wiki/Docs#allow_inline
int add(int a, int b) {
pragma(allow_inline);
asm { mov EAX, a; add EAX, b; }
}
And the other one is Inline asm expressions:
http://www.dsource.org/projects/ldc/wiki/InlineAsmExpressions
That are used like this:
// store val into dst
void store(ref int dst, int val) {
__asm("ldw r4, $1 ; stw r4, $0", "=*m,r,~{r4}", &dst, val);
}
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list