[fpc-devel] Tiny fix for codegenerator

Sergei Gorelkin sergei_gorelkin at mail.ru
Sun Nov 25 13:15:13 CET 2007


Hello,

I was wondering why Pascal statements like
"Inc(SomePointer, sizeof(WideChar))" are compiled into two assembler 
commands (mov ecx,2; add [location],ecx).
I found out that tcginlinenode.second_incdec checks second argument to 
be an ordinal constant. In my case, however, the second argument is 
being converted into pointer constant somewhere earlier, therefore
tcginlinenode.second_incdec forces it into register.
I added a check (see the patch attached) and now it is compiled into
"add [location],2", thus saving the register for other usage.

Regards,
Sergei
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ncginl.patch
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20071125/623a7ab3/attachment.ksh>


More information about the fpc-devel mailing list