diff dyncallback/dyncall_args_mips_o32.c @ 302:d55f9d508074

- mips softfloat support for o32 callconv (calls and callbacks, little and big endian) - cleanup of some mips files, removed unnecessary file, renamings.. - doc/manual cleanups, changelog entry
author Tassilo Philipp
date Mon, 21 May 2018 02:48:12 +0200
parents f5577f6bf97a
children 71c884e610f0
line wrap: on
line diff
--- a/dyncallback/dyncall_args_mips_o32.c	Sun May 20 02:23:44 2018 +0200
+++ b/dyncallback/dyncall_args_mips_o32.c	Mon May 21 02:48:12 2018 +0200
@@ -29,7 +29,12 @@
 DCint dcbArgInt(DCArgs* p)
 {
   DCint value;
-  p->freg_count = 2; /* first int will disable float reg use. */
+
+#if defined(DC__ABI_HARDFLOAT)
+  /* first int will disable float reg use. */
+  p->freg_count = 2;
+#endif /* DC__ABI_HARDFLOAT */
+
   value = *((int*)p->stackptr);
   p->stackptr += sizeof(int);
   return value;
@@ -63,19 +68,23 @@
 DCfloat dcbArgFloat(DCArgs* p)
 {
   DCfloat result;
+
+#if defined(DC__ABI_HARDFLOAT)
   if(p->freg_count < 2) {
 	/* Stored float regs (max 2) are always 8b aligned. The way we look them up, */
 	/* relative to a diverging p->stackptr, we need consider this. Only works    */
 	/* with up to two float args, which is all we need. Hacky, but saves us      */
 	/* from one more variable and more bookkeeping in DCArgs.                    */
     result = ((DCfloat*)(p->stackptr + ((int)p->stackptr & 4)) - 4) /* '-4' b/c those regs are stored right before the args */
-#if defined(DC__Endian_LITTLE)
+# if defined(DC__Endian_LITTLE)
       [0];
-#else
+# else
       [1];
-#endif
+# endif
 	++p->freg_count;
-  } else {
+  } else
+#endif /* DC__ABI_HARDFLOAT */
+  {
     result = *((DCfloat*)p->stackptr);
   }
   p->stackptr += sizeof(DCfloat);
@@ -88,12 +97,16 @@
     DCfloat f[2];
   } d;
   p->stackptr += ((int)p->stackptr & 4); /* Skip one slot if not aligned. */
+
+#if defined(DC__ABI_HARDFLOAT)
   if(p->freg_count < 2) {
     /*result = *((DCdouble*)p->stackptr-2); this changes the value, slightly*/
     d.f[0] = ((DCfloat*)p->stackptr-4)[0]; /* '-4' b/c those regs are stored right before the args */
     d.f[1] = ((DCfloat*)p->stackptr-4)[1];
     ++p->freg_count;
-  } else {
+  } else
+#endif /* DC__ABI_HARDFLOAT */
+  {
     /*result = *((DCdouble*)p->stackptr); this changes the value, slightly*/
     d.f[0] = ((DCfloat*)p->stackptr)[0];
     d.f[1] = ((DCfloat*)p->stackptr)[1];