[fpc-devel] Generated code of constant parameters of double type

Florian Klaempfl florian at freepascal.org
Sun Nov 16 17:54:09 CET 2008


Luiz Americo Pereira Camara schrieb:
> Jonas Maebe escreveu:
>>
>> On 16 Nov 2008, at 14:52, Florian Klaempfl wrote:
>>
>>> Luiz Americo Pereira Camara schrieb:
>>>> Maybe the documentation 
>>>> (http://www.freepascal.org/docs-html/ref/refsu50.html#x126-13300011.4.4) 
>>>> 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. 

Don't forget that this makes an extra memory access.



More information about the fpc-devel mailing list