How to use C macros in asm

Mihnea Balta dark_lkml@mymail.ro
Wed Nov 5 12:09:00 GMT 2003


If it's for registers, maybe you could use extended asm syntax like this:

#define REG "a"
    int     x;

    __asm__ __volatile__ ("     \n\
        movl %0, 0x01           \n\
    "
    :"="REG(x)
    :
    );

On Wednesday 05 November 2003 12:12, Kapileswar Rao wrote:
> Hello,
>     I am trying to use a C macro inside the asm instruction.But inside
> the asm instruction macro is not replaced by macro definition. Is there
> anyway I can do that.
>
> Here is an Example what I want to do.
>
> #define Register  R0
>
> asm("mov Register, #1");
>
> I want the Register in assembly instruction to be replaced by R0. Is
> there any option which could do that.
>
> Thanks and Regards,
> --Kapil
>
>
> ---------------------------------------------------------------
> Acasa.ro vine cu albumele, tu vino doar cu pozele ;)
> http://poze.acasa.ro/



More information about the Gcc-help mailing list