mirror of git://gcc.gnu.org/git/gcc.git
re PR libffi/42243 (powerpc-apple-darwin9 libffi failures)
PR libffi/42243 * src/powerpc/ffi_darwin.c (ffi_prep_args): Remove extra parentheses. From-SVN: r154956
This commit is contained in:
parent
154885548c
commit
be311914b8
|
@ -1,3 +1,8 @@
|
||||||
|
2009-12-03 David Edelsohn <edelsohn@gnu.org>
|
||||||
|
|
||||||
|
PR libffi/42243
|
||||||
|
* src/powerpc/ffi_darwin.c (ffi_prep_args): Remove extra parentheses.
|
||||||
|
|
||||||
2009-12-03 Uros Bizjak <ubizjak@gmail.com>
|
2009-12-03 Uros Bizjak <ubizjak@gmail.com>
|
||||||
|
|
||||||
* testsuite/libffi.call/cls_longdouble_va.c (main): Fix format string.
|
* testsuite/libffi.call/cls_longdouble_va.c (main): Fix format string.
|
||||||
|
|
|
@ -90,13 +90,12 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
|
||||||
|
|
||||||
/* 'fpr_base' points at the space for fpr1, and grows upwards as
|
/* 'fpr_base' points at the space for fpr1, and grows upwards as
|
||||||
we use FPR registers. */
|
we use FPR registers. */
|
||||||
double *fpr_base = (double *) ((stacktop - ASM_NEEDS_REGISTERS)
|
double *fpr_base = (double *) (stacktop - ASM_NEEDS_REGISTERS) - NUM_FPR_ARG_REGISTERS;
|
||||||
- NUM_FPR_ARG_REGISTERS);
|
|
||||||
int fparg_count = 0;
|
int fparg_count = 0;
|
||||||
|
|
||||||
|
|
||||||
/* 'next_arg' grows up as we put parameters in it. */
|
/* 'next_arg' grows up as we put parameters in it. */
|
||||||
unsigned long *next_arg = (unsigned long *) stack + 6; /* 6 reserved positions. */
|
unsigned long *next_arg = stack + 6; /* 6 reserved positions. */
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
double double_tmp;
|
double double_tmp;
|
||||||
|
@ -107,8 +106,8 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
|
||||||
unsigned size_al = 0;
|
unsigned size_al = 0;
|
||||||
|
|
||||||
/* Check that everything starts aligned properly. */
|
/* Check that everything starts aligned properly. */
|
||||||
FFI_ASSERT(((unsigned)(char *)stack & 0xF) == 0);
|
FFI_ASSERT(((unsigned) (char *) stack & 0xF) == 0);
|
||||||
FFI_ASSERT(((unsigned)(char *)stacktop & 0xF) == 0);
|
FFI_ASSERT(((unsigned) (char *) stacktop & 0xF) == 0);
|
||||||
FFI_ASSERT((bytes & 0xF) == 0);
|
FFI_ASSERT((bytes & 0xF) == 0);
|
||||||
|
|
||||||
/* Deal with return values that are actually pass-by-reference.
|
/* Deal with return values that are actually pass-by-reference.
|
||||||
|
@ -116,7 +115,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
|
||||||
Return values are referenced by r3, so r4 is the first parameter. */
|
Return values are referenced by r3, so r4 is the first parameter. */
|
||||||
|
|
||||||
if (flags & FLAG_RETVAL_REFERENCE)
|
if (flags & FLAG_RETVAL_REFERENCE)
|
||||||
*next_arg++ = (unsigned long)(char *)ecif->rvalue;
|
*next_arg++ = (unsigned long) (char *) ecif->rvalue;
|
||||||
|
|
||||||
/* Now for the arguments. */
|
/* Now for the arguments. */
|
||||||
for (i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv++)
|
for (i = ecif->cif->nargs; i > 0; i--, ptr++, p_argv++)
|
||||||
|
@ -127,7 +126,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
|
||||||
purpose registers are filled, the corresponding GPRs that match
|
purpose registers are filled, the corresponding GPRs that match
|
||||||
the size of the floating-point parameter are skipped. */
|
the size of the floating-point parameter are skipped. */
|
||||||
case FFI_TYPE_FLOAT:
|
case FFI_TYPE_FLOAT:
|
||||||
double_tmp = *(float *)*p_argv;
|
double_tmp = *(float *) *p_argv;
|
||||||
if (fparg_count >= NUM_FPR_ARG_REGISTERS)
|
if (fparg_count >= NUM_FPR_ARG_REGISTERS)
|
||||||
*(double *)next_arg = double_tmp;
|
*(double *)next_arg = double_tmp;
|
||||||
else
|
else
|
||||||
|
@ -138,7 +137,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FFI_TYPE_DOUBLE:
|
case FFI_TYPE_DOUBLE:
|
||||||
double_tmp = *(double *)*p_argv;
|
double_tmp = *(double *) *p_argv;
|
||||||
if (fparg_count >= NUM_FPR_ARG_REGISTERS)
|
if (fparg_count >= NUM_FPR_ARG_REGISTERS)
|
||||||
*(double *)next_arg = double_tmp;
|
*(double *)next_arg = double_tmp;
|
||||||
else
|
else
|
||||||
|
@ -163,7 +162,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
|
||||||
next_arg += 2;
|
next_arg += 2;
|
||||||
fparg_count += 2;
|
fparg_count += 2;
|
||||||
#else
|
#else
|
||||||
double_tmp = *((double *) *p_argv);
|
double_tmp = ((double *) *p_argv)[0];
|
||||||
if (fparg_count < NUM_FPR_ARG_REGISTERS)
|
if (fparg_count < NUM_FPR_ARG_REGISTERS)
|
||||||
*fpr_base++ = double_tmp;
|
*fpr_base++ = double_tmp;
|
||||||
else
|
else
|
||||||
|
@ -187,7 +186,7 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
|
||||||
goto putgpr;
|
goto putgpr;
|
||||||
#else
|
#else
|
||||||
*(long long *) next_arg = *(long long *) *p_argv;
|
*(long long *) next_arg = *(long long *) *p_argv;
|
||||||
next_arg+=2;
|
next_arg += 2;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case FFI_TYPE_POINTER:
|
case FFI_TYPE_POINTER:
|
||||||
|
@ -225,14 +224,13 @@ void ffi_prep_args(extended_cif *ecif, unsigned long *const stack)
|
||||||
Structures with 3 byte in size are padded upwards. */
|
Structures with 3 byte in size are padded upwards. */
|
||||||
size_al = (*ptr)->size;
|
size_al = (*ptr)->size;
|
||||||
/* If the first member of the struct is a double, then align
|
/* If the first member of the struct is a double, then align
|
||||||
the struct to double-word.
|
the struct to double-word. */
|
||||||
Type 3 is defined in include/ffi.h. #define FFI_TYPE_DOUBLE 3. */
|
if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE)
|
||||||
if ((*ptr)->elements[0]->type == 3)
|
|
||||||
size_al = ALIGN((*ptr)->size, 8);
|
size_al = ALIGN((*ptr)->size, 8);
|
||||||
if (size_al < 3 && ecif->cif->abi == FFI_DARWIN)
|
if (size_al < 3 && ecif->cif->abi == FFI_DARWIN)
|
||||||
dest_cpy += 4 - size_al;
|
dest_cpy += 4 - size_al;
|
||||||
|
|
||||||
memcpy((char *)dest_cpy, (char *)*p_argv, size_al);
|
memcpy((char *) dest_cpy, (char *) *p_argv, size_al);
|
||||||
next_arg += (size_al + 3) / 4;
|
next_arg += (size_al + 3) / 4;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue