aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorJames Lyon <jamesly0n@hotmail.com>2013-04-24 02:19:15 +0100
committerJames Lyon <jamesly0n@hotmail.com>2013-04-24 02:19:15 +0100
commit5c35ba66c5ade4713bbd9c005e66889f6d7db293 (patch)
tree1d513aae71d8264643f8b1d7b5c31472653c0c2e /tccgen.c
parent8a81f9e1036637e21a47e14fb56bf64133546890 (diff)
downloadtinycc-5c35ba66c5ade4713bbd9c005e66889f6d7db293.tar.gz
tinycc-5c35ba66c5ade4713bbd9c005e66889f6d7db293.tar.bz2
64-bit tests now pass (well, nearly).
tcctest1-3 fail, but this appears to be due to bugs in GCC rather than TCC (from manual inspection of the output).
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/tccgen.c b/tccgen.c
index d897296..0d1e21b 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -851,7 +851,13 @@ ST_FUNC int gv(int rc)
t = vtop->type.t;
t1 = t;
/* compute memory access type */
- if (vtop->r & VT_LVAL_BYTE)
+ if (vtop->r & VT_REF)
+#ifdef TCC_TARGET_X86_64
+ t = VT_PTR;
+#else
+ t = VT_INT;
+#endif
+ else if (vtop->r & VT_LVAL_BYTE)
t = VT_BYTE;
else if (vtop->r & VT_LVAL_SHORT)
t = VT_SHORT;
@@ -3712,7 +3718,24 @@ ST_FUNC void unary(void)
}
}
break;
-#if defined(TCC_TARGET_X86_64) && !defined(TCC_TARGET_PE)
+#ifdef TCC_TARGET_X86_64
+#ifdef TCC_TARGET_PE
+ case TOK_builtin_va_start:
+ {
+ next();
+ skip('(');
+ expr_eq();
+ skip(',');
+ expr_eq();
+ skip(')');
+ if ((vtop->r & VT_VALMASK) != VT_LOCAL)
+ tcc_error("__builtin_va_start expects a local variable");
+ vtop->r &= ~(VT_LVAL | VT_REF);
+ vtop->type = char_pointer_type;
+ vstore();
+ }
+ break;
+#else
case TOK_builtin_va_arg_types:
{
CType type;
@@ -3725,6 +3748,7 @@ ST_FUNC void unary(void)
}
break;
#endif
+#endif
case TOK_INC:
case TOK_DEC:
t = tok;