Hi!

Silly question: Does anything speak against using the predefined
__SDCCCALL macro that -- if present -- specifies the ABI version?

Am 10.09.22 um 20:06 schrieb Richard Hodges:
Hi, all.

I am finally getting to update my inline assembly for the new calling
version, started in 4.2 It is important to be compatible with the
earlier versions, and this is my approach.

In a common header file, I create __SDCC_VERSION and CALL_VERSION:

#define __SDCC_VERSION ((__SDCC_VERSION_MAJOR * 10) + __SDCC_VERSION_MINOR)
#if __SDCC_VERSION < 42
#define CALL_VERSION 0          /* Pre 4.2 */
#else
#define CALL_VERSION 1
#endif

And in a library file, I have a function that starts with:

static void emit_part(int w)
{
     w;
__asm
#if CALL_VERSION == 0
     ldw                x, (3, sp)
#endif

It seems to me that it would be useful to others if the version major
and minor number were combined (as I have above) and another SDCC define
for the calling convention version.

Comments? Thanks!

-Richard


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

Reply via email to