Lazarus
Free Pascal => Windows => Topic started by: 440bx on November 29, 2018, 05:38:24 pm
-
Hello,
I'd like to tell FPC to place one or more variables in registers. Is this possible and if so how ?
The other question I have is, is it possible to tell the compiler to optimize for the x86_64 architecture ?... those CPUs/mode have more registers available that the compiler can use to optimize code.
I tried -Or but, it didn't seem to have any effect (maybe I missed something else though)
Basically, what's the "magic" switch sauce that will produce the best possible code (tight and fast) for Windows 64bit applications ?
Thank you for your help.
-
I would expect that with -OoREGVAR set, fpc uses registers for optimizing function calls. This does make a noticeable difference to me when calling procedures in tight loops.
You may also tell the compiler to additionally use EBP and RBP, see here
http://wiki.freepascal.org/Optimization.
Regarding these, I did not notice any difference so far in my programs, but I guess any effects may be very code specific.
-
I would expect that with -OoREGVAR set, fpc uses registers for optimizing function calls. This does make a noticeable difference to me when calling procedures in tight loops.
I'll give that -OoREGVAR a try. Thank you for the suggestion.
I wish there was a way to tell the compiler to put a specific variable (or variables) in a register. There are times when that would not only make the code faster but also, a good bit smaller.