sparc: Eliminate long double ifdefs
This commit is contained in:
@@ -27,9 +27,19 @@
|
|||||||
|
|
||||||
#include <ffi.h>
|
#include <ffi.h>
|
||||||
#include <ffi_common.h>
|
#include <ffi_common.h>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE;
|
||||||
|
all further uses in this file will refer to the 128-bit type. */
|
||||||
|
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
||||||
|
# if FFI_TYPE_LONGDOUBLE != 4
|
||||||
|
# error FFI_TYPE_LONGDOUBLE out of date
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# undef FFI_TYPE_LONGDOUBLE
|
||||||
|
# define FFI_TYPE_LONGDOUBLE 4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* ffi_prep_args is called by the assembly routine once stack space
|
/* ffi_prep_args is called by the assembly routine once stack space
|
||||||
has been allocated for the function's arguments */
|
has been allocated for the function's arguments */
|
||||||
@@ -72,10 +82,7 @@ void ffi_prep_args_v8(char *stack, extended_cif *ecif)
|
|||||||
size_t z;
|
size_t z;
|
||||||
|
|
||||||
if ((*p_arg)->type == FFI_TYPE_STRUCT
|
if ((*p_arg)->type == FFI_TYPE_STRUCT
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
|| (*p_arg)->type == FFI_TYPE_LONGDOUBLE)
|
||||||
|| (*p_arg)->type == FFI_TYPE_LONGDOUBLE
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
*(unsigned int *) argp = (unsigned long)(* p_argv);
|
*(unsigned int *) argp = (unsigned long)(* p_argv);
|
||||||
z = sizeof(int);
|
z = sizeof(int);
|
||||||
@@ -176,9 +183,7 @@ int ffi_prep_args_v9(char *stack, extended_cif *ecif)
|
|||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case FFI_TYPE_FLOAT:
|
case FFI_TYPE_FLOAT:
|
||||||
case FFI_TYPE_DOUBLE:
|
case FFI_TYPE_DOUBLE:
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
|
||||||
case FFI_TYPE_LONGDOUBLE:
|
case FFI_TYPE_LONGDOUBLE:
|
||||||
#endif
|
|
||||||
ret = 1; /* We should promote into FP regs as well as integer. */
|
ret = 1; /* We should promote into FP regs as well as integer. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -296,9 +301,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif)
|
|||||||
case FFI_TYPE_VOID:
|
case FFI_TYPE_VOID:
|
||||||
case FFI_TYPE_FLOAT:
|
case FFI_TYPE_FLOAT:
|
||||||
case FFI_TYPE_DOUBLE:
|
case FFI_TYPE_DOUBLE:
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
|
||||||
case FFI_TYPE_LONGDOUBLE:
|
case FFI_TYPE_LONGDOUBLE:
|
||||||
#endif
|
|
||||||
cif->flags = cif->rtype->type;
|
cif->flags = cif->rtype->type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -351,9 +354,7 @@ int ffi_v9_layout_struct(ffi_type *arg, int off, char *ret, char *intg, char *fl
|
|||||||
break;
|
break;
|
||||||
case FFI_TYPE_FLOAT:
|
case FFI_TYPE_FLOAT:
|
||||||
case FFI_TYPE_DOUBLE:
|
case FFI_TYPE_DOUBLE:
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
|
||||||
case FFI_TYPE_LONGDOUBLE:
|
case FFI_TYPE_LONGDOUBLE:
|
||||||
#endif
|
|
||||||
memmove(ret + off, flt + off, (*ptr)->size);
|
memmove(ret + off, flt + off, (*ptr)->size);
|
||||||
off += (*ptr)->size;
|
off += (*ptr)->size;
|
||||||
break;
|
break;
|
||||||
@@ -412,10 +413,7 @@ void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
|
|||||||
FFI_ASSERT(0);
|
FFI_ASSERT(0);
|
||||||
#else
|
#else
|
||||||
if (rvalue && (cif->rtype->type == FFI_TYPE_STRUCT
|
if (rvalue && (cif->rtype->type == FFI_TYPE_STRUCT
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
|| cif->flags == FFI_TYPE_LONGDOUBLE))
|
||||||
|| cif->flags == FFI_TYPE_LONGDOUBLE
|
|
||||||
#endif
|
|
||||||
))
|
|
||||||
{
|
{
|
||||||
/* For v8, we need an "unimp" with size of returning struct */
|
/* For v8, we need an "unimp" with size of returning struct */
|
||||||
/* behind "call", so we alloc some executable space for it. */
|
/* behind "call", so we alloc some executable space for it. */
|
||||||
@@ -551,11 +549,7 @@ ffi_closure_sparc_inner_v8(ffi_closure *closure,
|
|||||||
|
|
||||||
/* Copy the caller's structure return address so that the closure
|
/* Copy the caller's structure return address so that the closure
|
||||||
returns the data directly to the caller. */
|
returns the data directly to the caller. */
|
||||||
if (cif->flags == FFI_TYPE_STRUCT
|
if (cif->flags == FFI_TYPE_STRUCT || cif->flags == FFI_TYPE_LONGDOUBLE)
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
|
||||||
|| cif->flags == FFI_TYPE_LONGDOUBLE
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
rvalue = (void *) gpr[0];
|
rvalue = (void *) gpr[0];
|
||||||
|
|
||||||
/* Always skip the structure return address. */
|
/* Always skip the structure return address. */
|
||||||
@@ -565,10 +559,7 @@ ffi_closure_sparc_inner_v8(ffi_closure *closure,
|
|||||||
for (i = 0; i < cif->nargs; i++)
|
for (i = 0; i < cif->nargs; i++)
|
||||||
{
|
{
|
||||||
if (arg_types[i]->type == FFI_TYPE_STRUCT
|
if (arg_types[i]->type == FFI_TYPE_STRUCT
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
|| arg_types[i]->type == FFI_TYPE_LONGDOUBLE)
|
||||||
|| arg_types[i]->type == FFI_TYPE_LONGDOUBLE
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
/* Straight copy of invisible reference. */
|
/* Straight copy of invisible reference. */
|
||||||
avalue[i] = (void *)gpr[argn++];
|
avalue[i] = (void *)gpr[argn++];
|
||||||
@@ -656,17 +647,12 @@ ffi_closure_sparc_inner_v9(ffi_closure *closure,
|
|||||||
argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
|
argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG;
|
||||||
|
|
||||||
/* Align on a 16-byte boundary. */
|
/* Align on a 16-byte boundary. */
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
|
||||||
if (arg_types[i]->type == FFI_TYPE_LONGDOUBLE && (argn % 2) != 0)
|
if (arg_types[i]->type == FFI_TYPE_LONGDOUBLE && (argn % 2) != 0)
|
||||||
argn++;
|
argn++;
|
||||||
#endif
|
|
||||||
if (i < fp_slot_max
|
if (i < fp_slot_max
|
||||||
&& (arg_types[i]->type == FFI_TYPE_FLOAT
|
&& (arg_types[i]->type == FFI_TYPE_FLOAT
|
||||||
|| arg_types[i]->type == FFI_TYPE_DOUBLE
|
|| arg_types[i]->type == FFI_TYPE_DOUBLE
|
||||||
#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE
|
|| arg_types[i]->type == FFI_TYPE_LONGDOUBLE))
|
||||||
|| arg_types[i]->type == FFI_TYPE_LONGDOUBLE
|
|
||||||
#endif
|
|
||||||
))
|
|
||||||
avalue[i] = ((char *) &fpr[argn]) - arg_types[i]->size;
|
avalue[i] = ((char *) &fpr[argn]) - arg_types[i]->size;
|
||||||
else
|
else
|
||||||
avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size;
|
avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size;
|
||||||
|
|||||||
Reference in New Issue
Block a user