On Tue, Apr 13, 2010 at 10:55 AM, Bingfeng Mei <[email protected]> wrote:
> Something like printf (Though I read somewhere glibc extension of printf
> make it non-pure).
Surely printf writes to global memory (it clobbers the stdout FILE*)
As for the original question - novops is internal only because its
semantics is purely internal and changes with internal aliasing
changes.
Now, we still lack a compelling example to see what exact semantics
you are requesting? I suppose it might be close to a pure but
volatile function? Which you could simulate by
dummy = pure_fn ();
asm ("" : "g" (dummy));
or even
volatile int dummy = pure_fn ();
Richard.
> Bingfeng
>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On
>> Behalf Of Andrew Haley
>> Sent: 12 April 2010 17:34
>> To: [email protected]
>> Subject: Re: Release novops attribute for external use?
>>
>> On 04/12/2010 05:27 PM, Bingfeng Mei wrote:
>> > Hello,
>> > One of our engineers requested a feature so that
>> > compiler can avoid to re-load variables after a function
>> > call if it is known not to write to memory. It should
>> > slash considerable code size in our applications. I found
>> > the existing "pure" and "const" cannot meet his requirements
>> > because the function is optimized out if it doesn't return
>> > a value.
>>
>> If a function doesn't write to memory and it doesn't return a
>> value, what is the point of calling it?
>>
>> Andrew.
>>
>>
>