question regarding asm()

Jeffrey A Law law@cygnus.com
Wed Oct 15 21:03:00 GMT 1997


  In message < E0xIhvT-00067k-00.1997-10-08-00-16-23_pgcc_forever@cerebro >you write:
  > David Edelsohn wrote:
  > >	Clobber just means that GCC cannot make assumptions about the
  > >register after the call, not before.
  > 
  > That's what I expected, but the docs seems to sugest otherwise..
Why do you think that?  I've always thought the same as David Edelsohn
about clobbers.

Given this asm:

     asm ("movl %0,r9;movl %1,r10;call _foo"
          : /* no outputs */
          : "g" (from), "g" (to)
          : "r9", "r10");

GCC should avoid allocating any of the inputs to the clobbered registers.

However, on some ports, when there aren't enough registers, GCC can't do
this, and in some cases it can't even tell you that it did something
wrong.  This is especially important on machines with weird register
sets like the x86.

This is _precisely_ why I've told folks in the past to avoid sucking
up all the registers for asms -- particularly Linux folk who seem to
write bigger asms than anyone.


jeff



More information about the Gcc mailing list