I didn't find examples of use register pragma. http://nim-lang.org/docs/manual.html#pragmas-register-pragma Where it is possible to find more detail information (syntax of use) on it?
Stefan_Salewski thanks. I tried this option. Nim makes the following (C) code: NI register foo;
From gcc doc: https://gcc.gnu.org/onlinedocs/gcc/Global-Register-Variables.html#Global-Register-Variables
shall be: register int foo asm ("r12");
Where insert name and why different syntax?
Have you tried something like
var mycounter {.register.} = 0
You can check the C sources if it is applied, but as the manual says, in nearly all cases the (C) compiler knows better.
Sure, instead of replying, edit your original message. If you don't want an answer, why not? ;-)
register int foo asm ("r12"); is not valid C, so that's why. But of course Nim has a solution for this:
var x {.codegenDecl: "$# $# asm(\"r12\")".}: int
Araq thanks. This nim code works:
var x {.codegenDecl: "register $# $# asm(\"r12\")".}: int