From b961ba5396ae235b914f8c211af0ffc07e7c6f04 Mon Sep 17 00:00:00 2001 From: James Lyon Date: Fri, 19 Apr 2013 11:08:12 +0100 Subject: 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). --- tccgen.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'tccgen.c') diff --git a/tccgen.c b/tccgen.c index 83ee171..c084186 100644 --- a/tccgen.c +++ b/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); } } -- cgit v1.3.1