I work on support for std atomics and currently attempt to switch from the initial idea of calling the routines to inlining the assembly code. Unfortunately I'm lost in the relationships between the code generator and SValue stack.
Let's say I have a pair of values stored in SValue stack, and want to load them into the registers %rdi and %rsi, and exactly these. This, I presume, means that, unlike for situation with function call, I have to save the registers.
Then some of the assembly code is generated via g()-like routine. After this code, I'd like to push the fact that the code, in fact, generated %rax as result.
Then, once we're done, the original values for %rdi and %rsi are restored.
Basically I'd like to make it function-call-like, only that it is intended to be inlined.
Could you, please, point me to the correct direction, or provide a minimal working example?