Is there any way I can make Nim store a specific variable (uint64 to be precise) into a specific register, for super-fast access?
Something along these lines:
register int *foo asm ("r12");
I am pretty sure you could drop into C with {.emit.} pragma and specify it this way, but it will not make your code faster.
https://stackoverflow.com/questions/578202/register-keyword-in-c
"It hasn't been relevant for at least 15 years as optimizers make better decisions about this than you can."
You can't take an address of a register, or maybe you can, it will just ignore it. It might cause errors. But it probably be mostly ignored. It's not clear...
If it did use the register it might make the code slower because then other things can't use the register when they need it more.
If you are compiling for x86 which uses "register renaming" is a technique that abstracts logical registers from physical registers. So you are not even doing what you think you are doing... https://en.wikipedia.org/wiki/Register_renaming