diff options
| author | grischka <grischka> | 2017-02-08 19:45:31 +0100 |
|---|---|---|
| committer | grischka <grischka> | 2017-02-08 19:45:31 +0100 |
| commit | 68666eee2ade45ab73b07361367d0a38d350d663 (patch) | |
| tree | 1cb0bdc6b04665e96ba563a137bea20bf909fdca /arm64-gen.c | |
| parent | f077d16c20c524d7db8cb38a9193242eeade343d (diff) | |
| download | tinycc-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 'arm64-gen.c')
| -rw-r--r-- | arm64-gen.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/arm64-gen.c b/arm64-gen.c index 71e977e..0ff6099 100644 --- a/arm64-gen.c +++ b/arm64-gen.c @@ -1193,9 +1193,9 @@ ST_FUNC int gfunc_sret(CType *vt, int variadic, CType *ret, return 0; } -ST_FUNC void greturn(void) +ST_FUNC void gfunc_return(CType *func_type) { - CType *t = &func_vt; + CType *t = func_type; unsigned long a; arm64_pcs(0, &t, &a); @@ -1203,8 +1203,8 @@ ST_FUNC void greturn(void) case -1: break; case 0: - if ((func_vt.t & VT_BTYPE) == VT_STRUCT) { - int align, size = type_size(&func_vt, &align); + if ((func_type->t & VT_BTYPE) == VT_STRUCT) { + int align, size = type_size(func_type, &align); gaddrof(); gv(RC_R(0)); arm64_ldrs(0, size); @@ -1213,7 +1213,7 @@ ST_FUNC void greturn(void) gv(RC_IRET); break; case 1: { - CType type = func_vt; + CType type = *func_type; mk_pointer(&type); vset(&type, VT_LOCAL | VT_LVAL, func_vc); indir(); @@ -1222,7 +1222,7 @@ ST_FUNC void greturn(void) break; } case 16: - if ((func_vt.t & VT_BTYPE) == VT_STRUCT) { + if ((func_type->t & VT_BTYPE) == VT_STRUCT) { uint32_t j, sz, n = arm64_hfa(&vtop->type, &sz); gaddrof(); gv(RC_R(0)); @@ -1237,6 +1237,7 @@ ST_FUNC void greturn(void) default: assert(0); } + vtop--; } ST_FUNC void gfunc_epilog(void) |
