This is the mail archive of the gcc@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]

Re: question regarding asm()


  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


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