Re: clobber list in inline assembly for calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Daniel Mierswa <impulze@xxxxxxxxxxx> writes:

> On 08.01.2011 06:23, Ian Lance Taylor wrote:
>> Good point, yes, you should add an explicit "memory" clobber.  You don't
>> need to explicitly clobber "cc".  That is a fixed register (actually gcc
>> calls it "flags") and as such gcc won't make any particular assumptions
>> about it in any case.
>> 
>> Ian
>
> Ok I'm curious as to why.
>
> If the information at
> http://www.ibiblio.org/gferg/ldp/GCC-Inline-Assembly-HOWTO.html#ss5.3 is
> of any use then I'd have to:
>
> [...]
> If our instruction can alter the condition code register, we have to add
> "cc" to the list of clobbered registers.
>
> If our instruction modifies memory in an unpredictable fashion, add
> "memory" to the list of clobbered registers.
> [...]
>
> I don't know if any of both situations may happen in my called function,
> hence I'd have to supply both, or am I wrong?

You can add a clobber of "cc" if you like, it just won't make any
difference one way or another.  On x86 gcc already assumes that the
flags are clobbered by an asm.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux