>
> Consider an operating system. I write some code that does the
> following:
>
> a) Load registers into some LLVM IR registers (using inline asm)
> b) Modify the registers slightly
> c) Use volatile stores to save the registers into a stack-allocated
> area
> d) Context switch
> e) Use volatile loads to reload the registers from the stack-
> allocated area
>
the register save/restore code should be in the assembly written
context-switch
part, not in high level C part.
think analogously about setjmp/longjmp, no one would ever factor the
register
save/restore out of the rest of the setjmp/longjmp logic.
Peter Lawrence.