aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorJames Lyon <jamesly0n@hotmail.com>2013-04-19 11:08:12 +0100
committerJames Lyon <jamesly0n@hotmail.com>2013-04-19 11:10:13 +0100
commitb961ba5396ae235b914f8c211af0ffc07e7c6f04 (patch)
treea1bfdc3e819b1b643b4da79ca09f2f92c594613a /tccgen.c
parent55ea6d3fc175b0e01e2e946ca9b319c1fbe8aa67 (diff)
downloadtinycc-b961ba5396ae235b914f8c211af0ffc07e7c6f04.tar.gz
tinycc-b961ba5396ae235b914f8c211af0ffc07e7c6f04.tar.bz2
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).
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c18
1 files changed, 5 insertions, 13 deletions
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);
}
}