[fpc-devel] [patch] a tweak to reduce the number of temps

Sergei Gorelkin sergei_gorelkin at mail.ru
Sun Sep 20 15:09:46 CEST 2009


Hello,

It looks that I could finally figure out why the hell every type 
conversion was done involving an intermediate temp.

This happened because node processing order was a bit incorrect.
See the attached patch. Since argument of firstpass is passed by 
reference, freeing the old node before firstpassing the new one
actually causes the tree contain an invalid pointer for the duration of 
firstpassing that new node.

In case of string type conversion, the typeconvn was replaced by a 
calln, but that calln never optimized its return location because it 
failed the test "if aktassignmentnode.right=self";
aktassignmentnode.right was still equal to the typeconvn.

The patch has great effect on generated code in general and on low-level 
RTL stuff in particular.

Regards,
Sergei

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pass_1.diff
Type: text/x-patch
Size: 1838 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20090920/41145146/attachment.bin>


More information about the fpc-devel mailing list