Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jul 2001 01:26:37 -0700
From:      Terry Lambert <tlambert2@mindspring.com>
To:        Farooq Mela <fmela0@sm.socccd.cc.ca.us>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Quick question about x86 asm
Message-ID:  <3B5699BD.10BE44F8@mindspring.com>
References:  <3B554445.193CE946@sm.socccd.cc.ca.us> <3B55BD97.A6E40F1E@mindspring.com> <3B567452.36965E56@sm.socccd.cc.ca.us>

next in thread | previous in thread | raw e-mail | index | archive | help
Farooq Mela wrote:
> > cc -S is your friend.
> 
> Right, well that can certainly help, but what gcc generates can be
> dependant on calling convention, optimization setting, &c &c, and
> though the code generated in one particular scenario may not be an
> absolute indicator of it's behavior. In other words, I was looking for
> more of a "yes" or "no" type response ;-). Anyway, redirecting this
> question to a gcc list.

The correct assembly code to use is "dependent on the calling
convention, &c, &c" of the C code you are going to link it
into, so that's not a strong argument.

Given a function argument list and return type, it's going to
remain pretty constant, so long as you compile your -S function
in an isolated environment, such that it has to be capable of
linking against other code, once assembled ...in other words,
you don't have to worry about the peephole optimizer being
able to span multiple object files, so it's not really a
problem that involves changes to calling convetion or tail
call or other optimization.

The answer you were probably looking for is that the eax
register is _not_ loaded with a return value in the "void"
case, but it may contain a value different than when it
went in, anyway, if the register ended up being used for
scratch.

-- Terry

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3B5699BD.10BE44F8>