When generating lightning instructions from higher level code, scratch registers are sometimes needed (for example, to code a move from memory to memory).
The generating code could analyze which registers do not contain live data and use those as scratch registers (if there are none, it has to spill some registers).
Browsing through the lighting source code it seems that lightning already contains some liveness analysis and some spilling algorithm. It would be great if some interface to this could be offered to user code, for example by offering two "virtual registers" that are emulated by overlaying them to real registers (that are either dead or spilled during the live time of the virtual registers).
On some ports, e.g. the AMD64 port, these virtual registers could, in fact, be real registers like RSI or RDI most of the time, which are usually only used for arguments to C procedure calls, and are wasted otherwise.