What about an additional pre-processing stage that transforms syntax
variant 1 to variant 2?

It could turn

__asm
    add a,b
    add a,c
__endasm

into

__asm__(
    "add a,b\n"
    "add a,c\n"
)

Another option would be to rely on a mechanism similar to C++11-style
raw string literals (i.e. R""), because they may contain newlines.

Greetings,
Benedikt


Am 14.07.22 um 12:58 schrieb Philipp Klaus Krause:
> SDCC currently supports two forms of inline assembler:
>
> 1:
> __asm
> asm code here
> __endasm;
>
> and
>
> 2:
> __asm("asm code here");
>
> Form 1 requires some ugly hacks to avoid conflicts in the preprocessor.
> I wonder if we could drop those, and maybe even change the keyword in
> form 2 to __asm__.
>
> Does anyone rely on form 1 and would not want support for it dropped?
> Any opinions on the possible rename of form 2?
>
> For comparison, GCC and clang both use:
>
> __asm__("asm code here");
>
> as well as the following variants:
>
> * Using asm instead of __asm__
>
> Which I think we do not want
>
> * __asm__("asm code here" : Output);
> * __asm__("asm code here" : Output : Input);
> * __asm__("asm code here" : Output : Input : Clobbers);
> * __asm__ goto("asm code here" : Output : Input : Clobbers : Labels);
>
> These variants (which GCC allows in non-naked functions only) we might
> want to support sometime (depending on user demand and SDCC developers
> finding time to implement it).
>
> Philipp


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to