<HTML>
<style> BODY { font-family:Arial, Helvetica, sans-serif;font-size:12px; }</style>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.<br>
<div><br>
</div><div>Gareth<br>
</div> <br>
<br>
<span style="font-weight: bold;">On Tue 12/06/18 22:45 , nickysn@gmail.com sent:<br>
</span><blockquote style="BORDER-LEFT: #F5F5F5 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">On Mon, 2018-06-11 at 21:07 +0100, J. Gareth Moreton wrote:
<br>
<span style="color: rgb(102, 102, 102);">> Thanks David,
</span><br>
<span style="color: rgb(102, 102, 102);">>
</span><br>
<span style="color: rgb(102, 102, 102);">> I'm still learning some of the nuances of the Intel and AMD
</span><br>
<span style="color: rgb(102, 102, 102);">> processors, but most of it is just logical analysis. Admittedly my
</span><br>
<span style="color: rgb(102, 102, 102);">> main drive has been to shrink down the size of the binary, since
</span><br>
<span style="color: rgb(102, 102, 102);">> Delphi and Free Pascal have always been a little bit bloated in
</span><br>
<span style="color: rgb(102, 102, 102);">> comparison. Not that it is necessarily a bad thing, but saving space
</span><br>
<span style="color: rgb(102, 102, 102);">> without sacrificing performance can only be a good thing, especially
</span><br>
<span style="color: rgb(102, 102, 102);">> for those with limited bandwidth or for saving those few precious
</span><br>
<span style="color: rgb(102, 102, 102);">> bytes when burning files to a CD or DVD.
</span><br>
<span style="color: rgb(102, 102, 102);">>
</span><br>
<span style="color: rgb(102, 102, 102);">> There have been a few instances in the compiled compiler (my main
</span><br>
<span style="color: rgb(102, 102, 102);">> test case) where an entire register is freed up due to my deep
</span><br>
<span style="color: rgb(102, 102, 102);">> optimisation, and that means the corresponding "push" and "pop" at
</span><br>
<span style="color: rgb(102, 102, 102);">> either end of the procedure can be removed (along with the
</span><br>
<span style="color: rgb(102, 102, 102);">> corresponding stack unwinding information), although I haven't
</span><br>
<span style="color: rgb(102, 102, 102);">> started programming that yet.
</span><br>
<br>
Isn't it better to perform this optimization before register
<br>
allocation. Then, when this happens, the corresponding "push" and "pop"
<br>
wouldn't even be put by the compiler, because the register wouldn't
<br>
have to be spilled.
<br>
<br>
Nikolay
<br>
</blockquote></HTML>