[fpc-devel] about bug 0016668 (-gt -O2)

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Jun 8 17:52:17 CEST 2010


On 08 Jun 2010, at 17:03, Martin wrote:

> That is, of course the local var, that would have gone into edx, may have been optimized away:
> - The part of the compiler writing the comments, may have been aware of that
> - -gt may not have been aware of that

It's the function result variable. edx isn't reused because the function result is immediately overwritten with the result of the call. At that point, the register allocator in combination with SSA changes the register allocated to the function result from edx to eax, because that is the register in which the function result has to be returned.

See also http://bugs.freepascal.org/view.php?id=7552

> I don't know, if edx needs to be saved on the stack, if it is used by the method? I have seen that other registers are usually saved on the stack, before they get used?

edx does not have to be saved (and neither do eax and ecx).


Jonas


More information about the fpc-devel mailing list