Re: Quick question about x86 asm

2001-07-19 Thread Terry Lambert

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 [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: Quick question about x86 asm

2001-07-18 Thread Terry Lambert

Farooq Mela wrote:
 
 Hi -hackers,
 
 I'm developing some assembly routines that are called from a C library
 under FreeBSD.  Some of these routines do not return anything (ie,
 prototyped in C, their return type is 'void').  Does the compiler
 expect that the asm routines that don't return anything will preserve
 the value of %eax?  That is, must we push it and later pop it before
 returning from the routine, or are we free to modify it as we please
 without restoring its value to what it was when the routine was
 called?

cc -S is your friend.

-- Terry

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message



Re: Quick question about x86 asm

2001-07-18 Thread Farooq Mela

Terry Lambert 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.

-- 
farooq [EMAIL PROTECTED]

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-hackers in the body of the message