Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Inline assembler question

Author: Dieter Buerssner

Date: 11:34:31 01/16/02

Go up one level in this thread


On January 16, 2002 at 14:11:39, Bo Persson wrote:

>On January 15, 2002 at 21:13:05, James Robertson wrote:
>
>>Suppose I write an inline function containing assembler code, or I just insert
>>some assembler stuff in the middle of a large block of C code. Obviously, when I
>>write my assembler lines I will be stomping on registers, simply because the
>>syntax requires I use 'eax' or 'ebx' in such simple commands as 'mov eax,ebx'.
>>Suppose though that I really don't care what registers are used and I would like
>>the compiler to replace the registers in my assembler code with whatever it
>>finds convenient and will best benefit the surrounding code. How can I do this?
>
>You can't.  :-)

With gcc you can. But explaining the gcc inline assembler synthax would take a
lot of writing. The gcc manual has a nice chapter about it. Essentially, if you
use "r" as constraint, gcc will allocate a general register for this. There are
many more constraints. It is unfortunately not very easy to use.

Regards,
Dieter







This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.