This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: clobber list in inline assembly for calls
- From: Ian Lance Taylor <iant at google dot com>
- To: Daniel Mierswa <impulze at impulze dot org>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 07 Jan 2011 20:50:04 -0800
- Subject: Re: clobber list in inline assembly for calls
- References: <4D27B05F.8010300@impulze.org>
Daniel Mierswa <impulze@impulze.org> writes:
> I was wondering which registers I have to clobber or which special
> strings I have to put into the clobber list if all I'm going to do is:
>
> asm("call %0;" ::"m"(addr_of_myfunc));
>
> As I can't tell what the function is doing I may have to clobber all
> registers or am I wrong?
> I had in mind to clobber "cc" plus "eax", "ecx", "edx" which are by the
> i386 ABI not preserved for the caller.
You are correct: you have to list all the caller-saved registers in the
clobber list. On 32-bit x86 this is all the registers other than %ebp,
%ebx, %edi and %esi.
Ian