Ideally yes, but this occurs after peephole optimisations where all of the register allocations have already been made. Doing the peephole and deep optimisations while the registers are still in a virtual state would be better overall, but may require a huge overhaul of the compiler that might be asking for too much trouble. There's also the issue that some commands only work with certain registers, and optimisations have to be careful of that fact.
Gareth On Tue 12/06/18 22:45 , nick...@gmail.com sent: On Mon, 2018-06-11 at 21:07 +0100, J. Gareth Moreton wrote: > Thanks David, > > I'm still learning some of the nuances of the Intel and AMD > processors, but most of it is just logical analysis. Admittedly my > main drive has been to shrink down the size of the binary, since > Delphi and Free Pascal have always been a little bit bloated in > comparison. Not that it is necessarily a bad thing, but saving space > without sacrificing performance can only be a good thing, especially > for those with limited bandwidth or for saving those few precious > bytes when burning files to a CD or DVD. > > There have been a few instances in the compiled compiler (my main > test case) where an entire register is freed up due to my deep > optimisation, and that means the corresponding "push" and "pop" at > either end of the procedure can be removed (along with the > corresponding stack unwinding information), although I haven't > started programming that yet. Isn't it better to perform this optimization before register allocation. Then, when this happens, the corresponding "push" and "pop" wouldn't even be put by the compiler, because the register wouldn't have to be spilled. Nikolay
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel