aboutsummaryrefslogtreecommitdiff
path: root/x86_64-gen.c
diff options
context:
space:
mode:
authorgrischka <grischka>2017-02-08 19:45:31 +0100
committergrischka <grischka>2017-02-08 19:45:31 +0100
commit68666eee2ade45ab73b07361367d0a38d350d663 (patch)
tree1cb0bdc6b04665e96ba563a137bea20bf909fdca /x86_64-gen.c
parentf077d16c20c524d7db8cb38a9193242eeade343d (diff)
downloadtinycc-68666eee2ade45ab73b07361367d0a38d350d663.tar.gz
tinycc-68666eee2ade45ab73b07361367d0a38d350d663.tar.bz2
tccgen: factor out gfunc_return
Also: - on windows i386 and x86-64, structures of size <= 8 are NOT returned in registers if size is not one of 1,2,4,8. - cleanup: put all tv-push/pop/swap/rot into one place
Diffstat (limited to 'x86_64-gen.c')
-rw-r--r--x86_64-gen.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/x86_64-gen.c b/x86_64-gen.c
index c94eb05..7b61b48 100644
--- a/x86_64-gen.c
+++ b/x86_64-gen.c
@@ -752,25 +752,21 @@ void gen_offs_sp(int b, int r, int d)
ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, int *ret_align, int *regsize)
{
int size, align;
- *regsize = 8;
*ret_align = 1; // Never have to re-align return values for x86-64
+ *regsize = 8;
size = type_size(vt, &align);
- ret->ref = NULL;
- if (size > 8) {
+ if (size > 8 || (size & (size - 1)))
return 0;
- } else if (size > 4) {
+ if (size == 8)
ret->t = VT_LLONG;
- return 1;
- } else if (size > 2) {
+ else if (size == 4)
ret->t = VT_INT;
- return 1;
- } else if (size > 1) {
+ else if (size == 2)
ret->t = VT_SHORT;
- return 1;
- } else {
+ else
ret->t = VT_BYTE;
- return 1;
- }
+ ret->ref = NULL;
+ return 1;
}
static int is_sse_float(int t) {