Got test1-3 working on x86-64.
There are probably still issues on x86-64 I've missed. I've added a few new tests to abitest, which fail (2x long long and 2x double in a struct should be passed in registers).
This commit is contained in:
18
tccgen.c
18
tccgen.c
@ -2067,6 +2067,9 @@ ST_FUNC int type_size(CType *type, int *a)
|
||||
} else if (bt == VT_SHORT) {
|
||||
*a = 2;
|
||||
return 2;
|
||||
} else if (bt == VT_QLONG || bt == VT_QFLOAT) {
|
||||
*a = 8;
|
||||
return 16;
|
||||
} else {
|
||||
/* char, void, function, _Bool */
|
||||
*a = 1;
|
||||
@ -3695,24 +3698,13 @@ ST_FUNC void unary(void)
|
||||
#ifdef TCC_TARGET_X86_64
|
||||
case TOK_builtin_va_arg_types:
|
||||
{
|
||||
/* This definition must be synced with stdarg.h */
|
||||
enum __va_arg_type {
|
||||
__va_gen_reg, __va_float_reg, __va_stack
|
||||
};
|
||||
CType type;
|
||||
int bt;
|
||||
next();
|
||||
skip('(');
|
||||
parse_type(&type);
|
||||
skip(')');
|
||||
bt = type.t & VT_BTYPE;
|
||||
if (bt == VT_STRUCT || bt == VT_LDOUBLE) {
|
||||
vpushi(__va_stack);
|
||||
} else if (bt == VT_FLOAT || bt == VT_DOUBLE) {
|
||||
vpushi(__va_float_reg);
|
||||
} else {
|
||||
vpushi(__va_gen_reg);
|
||||
}
|
||||
vpushi(classify_x86_64_va_arg(&type));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@ -4966,7 +4958,7 @@ static void init_putz(CType *t, Section *sec, unsigned long c, int size)
|
||||
vpush_global_sym(&func_old_type, TOK_memset);
|
||||
vseti(VT_LOCAL, c);
|
||||
vpushi(0);
|
||||
vpushi(size);
|
||||
vpushs(size);
|
||||
gfunc_call(3);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user