3 ms·
Nearly. You need register and to also pass them into (potentially no-op) inline asm. `register int v("eax")` iirc, but it's been years since I did this. The 'r
by JonChesterfield 4y ago
Nearly. You need register and to also pass them into (potentially no-op) inline asm. `register int v("eax")` iirc, but it's been years since I did this.
The 'register' is indeed largely ignored, but it has the additional somewhat documented meaning of 'when this variable goes into inline asm, it needs to be in that register'. In between asm blocks it can be elsewhere - stack or whatever - but it still gives the regalloc a really clear guide to work from.
- lifthrasiir 4y agoIt's `register int v asm("eax")`. However they are very easily elided, especially after higher optimization levels; compilers are very open about this [1]. [1] https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html#Local-Register-Variables https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables....
- deleted 4y ago[deleted]