This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: question regarding asm()
- To: Marc Lehmann <pcg at goof dot com>
- Subject: Re: question regarding asm()
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Wed, 15 Oct 1997 22:05:34 -0600
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
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