Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Inline Assembly?

The parser can handle function-style asm constructs. However, because this is not standard c or c++, it does not do that per default. To turn the feature on, you need to use a custom language (extend GPPLanguage or GCCLanguage and override getParserExtensionConfiguration()).

You may want to create a bug to make the parser handle this c++ extension per default. 

Markus.

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of kesselhaus
Sent: Sonntag, 16. Jänner 2011 12:50
To: CDT General developers list.
Subject: [cdt-dev] Inline Assembly?
Importance: Low

Hi folks,

We have some C files, which have Inline Assembly for ePPC.
Currently, I have lots of Syntax Errors there. I currently have 
undefined __asm in Project Settings so at least the function itself has 
not the syntax error set.

Which way is CDT handling Inline Assembly, if at all?

__asm void foo(void)
{
     lis     r0, 0x4000@ha
     ori     r0,r0, 0x1000@l
     mfspr   r3, SPR_XYZ
     stw     r3, 0(r1)
}

or rather

void foo(void)
{
     __asm {
             lis     r0, 0x4000@ha
             ori     r0,r0, 0x1000@l
             mfspr   r3, SPR_XYZ
             stw     r3, 0(r1)
     };
}

or gnu style like

void foo(void)
{
    asm(
     "lis     r0, 0x4000@ha"
     "ori     r0,r0, 0x1000@l"
     "mfspr   r3, SPR_XYZ"
     "stw     r3, 0(r1)"
     , /*in*/ : /*out*/: /*clobber*/ );
}

And how are the assembler instructtions setup?

_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


Back to the top