[fpc-devel] Tiny fix for codegenerator
Jonas Maebe
jonas.maebe at elis.ugent.be
Sun Nov 25 13:26:10 CET 2007
On 25 Nov 2007, at 13:15, Sergei Gorelkin wrote:
> 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.
It would probably be better to just check whether
location.loc=LOC_CONST and then use location.value (this code
presumable predates the existence of LOC_CONST). Then you don't have
to care about the node type.
Jonas
More information about the fpc-devel
mailing list