This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: clobber list in inline assembly for calls


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?

-- 
Mierswa, Daniel

If you still don't like it, that's ok: that's why I'm boss. I simply
know better than you do.
               --- Linus Torvalds, comp.os.linux.advocacy, 1996/07/22


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]