Unsaved register?
Erik Walthinsen
omega@temple-baptist.com
Tue May 29 16:56:00 GMT 2001
On Tue, 29 May 2001, Michael Meissner wrote:
> On Tue, May 29, 2001 at 04:21:45PM -0700, Erik Walthinsen wrote:
> > I thought that a function call was implicitely supposed to restore all the
> > state it clobbers? It's a full C function, no asm at all. How is the
> > calling code supposed to know which registers are going to be clobbered?
>
> The compiler always implements an ABI that describes which registers are
> assumed to be clobbered, which are used to pass arguments, which are used to
> return arguments, and which registers must be preserved across calls.
> Generally if there is an existing ABI or native compiler, GCC uses that ABI.
But if the compiler then has all the knowledge of which registers can be
clobbered across a function call (and presumably %ecx is one of them),
should it not also automatically avoid allocating that register to a
variable used in inline asm, esp since it's used both before and after the
call?
BTW, I 'fixed' the problem by listing %ecx as a clobbered register in the
bitstream_get_mmx function, but that's a hack. I can also 'fix' it by
turning on the printf at the top of the function, which happens to cause
gcc to allocate different registers.
Erik Walthinsen <omega@temple-baptist.com> - System Administrator
__
/ \ GStreamer - The only way to stream!
| | M E G A ***** http://gstreamer.net/ *****
_\ /_
More information about the Gcc-bugs
mailing list