[fpc-devel] Generated code of constant parameters of double type
Luiz Americo Pereira Camara
pascalive at bol.com.br
Sun Nov 16 15:20:40 CET 2008
Jonas Maebe escreveu:
> On 16 Nov 2008, at 14:52, Florian Klaempfl wrote:
>> Luiz Americo Pereira Camara schrieb:
>>> Maybe the documentation
>>> can be modified to clarify this since the statement:
>>> "A constant argument is passed by reference if its size is larger
>>> than a pointer."
>>> leads to the conclusion that double types (8 bytes) would be passed
>>> as reference in 32bit code.
>> Well, the bigger problem is that this is target dependent.
> And calling convention dependent. In most cases, how exactly constant
> and value parameters are handled by the compiler is a private
> implementation detail. You cannot count on how it is exactly implemented.
Ok. I was not counting in implementation details.
My point was that this could be a missing optimization opportunity: pass
by reference a 8 bytes parameter when the pointer size is 4. I also
tested with TPoint (8 bytes) and it's passed by reference unlike double
(also 8 bytes) that is passed by value always.
Probably i'm missing some information why double is treated differently
of a record of same size. I don't have compiler knowledge. All my
conclusions came from the documentation.
More information about the fpc-devel