Register Preservation in Inline ASM Blocks
dsimcha
dsimcha at yahoo.com
Fri Nov 19 17:17:19 PST 2010
What is the rule on who is responsible for saving registers when inserting an
inline ASM block into the middle of a function? For example:
void fun() {
auto ptr = somePointer();
asm {
mov EAX, ptr;
lock;
inc [EAX];
}
}
Is this acceptable (will the compiler do what it needs to do to deal with my
usage of EAX), or do I need to do something more like:
asm {
push EAX;
lock;
inc [EAX];
pop EAX;
}
, leaving EAX exactly as I found it?
More information about the Digitalmars-d
mailing list