Loading...

gcc-help@gcc.gnu.org

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Preventing scheduling of normal operations across calls to built-ins Ayonam Ray Wed Feb 22 12:01:22 2012

On 22 February 2012 23:52, Ian Lance Taylor <[EMAIL PROTECTED]> wrote:
> Ayonam Ray <[EMAIL PROTECTED]> writes:
>
>> I'm wondering whether the compiler upon seeing an enum and an
>> immediate value as the arguments to the builtin is assuming that the
>> builtin does not have or create any dependence on the rest of the
>> code.
>
> That by itself should not do it unless you mark the builtin function as
> pure or const, which you did not do.
>
> I suspect that what is happening is something related but slightly
> different.  The problem is not the arguments you are passing to the
> builtin function, it's the fact that your other code does not depend on
> memory, and gcc knows that a function call can only affect memory,
> nothing else.  So gcc thinks that your other operations are independent
> of your builtin function.
>
> I think you are going to have to expand your builtin function into an
> asm very early on, and that asm is going to have to clobber all
> registers.  There may be some other way to implement this, but offhand I
> don't know of one.
>
> Ian

Ian,

I will give it a try.  Is there a way to mark all registers as
clobbered in an RTL (like we can do for memory using (clobber (mem:BLK
(const_int 0))) )?

Regards
Ayonam