Revert "fix-mixed-struct (patch by Pip Cet)"

This reverts commit 4e04f67c94. Requested by grischka.
This commit is contained in:
gus knight
2015-07-29 16:57:41 -04:00
parent 89ad24e7d6
commit ef3d38c5c9
8 changed files with 232 additions and 456 deletions

View File

@ -34,8 +34,6 @@
#define NB_REGS 9
#endif
typedef int RegArgs;
#ifndef TCC_ARM_VERSION
# define TCC_ARM_VERSION 5
#endif
@ -869,14 +867,9 @@ int floats_in_core_regs(SValue *sval)
}
}
ST_FUNC int regargs_nregs(RegArgs *args)
{
return *args;
}
/* Return the number of registers needed to return the struct, or 0 if
returning via struct pointer. */
ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int *regsize, RegArgs *args) {
ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int *regsize) {
#ifdef TCC_ARM_EABI
int size, align;
size = type_size(vt, &align);
@ -886,20 +879,18 @@ ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int
*regsize = 8;
ret->ref = NULL;
ret->t = VT_DOUBLE;
*args = (size + 7) >> 3;
return (size + 7) >> 3;
} else if (size <= 4) {
*ret_align = 4;
*regsize = 4;
ret->ref = NULL;
ret->t = VT_INT;
*args = 1;
return 1;
} else
*args = 0;
return 0;
#else
*args = 0;
return 0;
#endif
return *args != 0;
}
/* Parameters are classified according to how they are copied to their final
@ -1269,7 +1260,6 @@ void gfunc_prolog(CType *func_type)
int n, nf, size, align, rs, struct_ret = 0;
int addr, pn, sn; /* pn=core, sn=stack */
CType ret_type;
RegArgs dummy;
#ifdef TCC_ARM_EABI
struct avail_regs avregs = AVAIL_REGS_INITIALIZER;
@ -1281,7 +1271,7 @@ void gfunc_prolog(CType *func_type)
n = nf = 0;
if ((func_vt.t & VT_BTYPE) == VT_STRUCT &&
!gfunc_sret(&func_vt, func_var, &ret_type, &align, &rs, &dummy))
!gfunc_sret(&func_vt, func_var, &ret_type, &align, &rs))
{
n++;
struct_ret = 1;