:: Re: [DNG] OT: Assembly resources
Top Pagina
Delete this message
Reply to this message
Auteur: Rainer Weikusat
Datum:  
Aan: dng
Onderwerp: Re: [DNG] OT: Assembly resources
Emiliano Marini <emilianomarini82@???> writes:
> Maybe the C compiler adjusts what registers to use for C code to avoid
> conflicts, or saves his registers on the stack before the assembly code.
> I'm just guessing, I never embed assembly code in C programs.


When using gcc inline assembly, one will usually either use named
parameters and get the compiler to allocated registers for them based on
"parameter property specifications" or one will have to specifiy certain
registers as 'clobbered' by an inline asm.

>
> On Wed, Mar 2, 2016 at 7:17 PM, Hendrik Boom <hendrik@???> wrote:
>
>> On Wed, Mar 02, 2016 at 08:55:20AM -0300, Emiliano Marini wrote:
>> > But be aware that gas is the one GCC uses for in-line assembly embedded
>> in
>> > C programs. So, if you are planning to embed assembly instructions in C
>> > code, you will need to learn gas syntax.
>>
>> I've always wondered how the C code generator manages not to get
>> confused between the registers I use and the ones it allocates.
>>
>> -- hendrik