diff options
| author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2010-12-28 19:09:59 +0900 |
|---|---|---|
| committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2010-12-28 19:09:59 +0900 |
| commit | 07fd82b4113c9f912383dff448e3dd8b71179b7b (patch) | |
| tree | e5767d5770adbccf2cc81ca92c08aa87f81df659 | |
| parent | 83f0a7b6f89dcb50b8a69e006001d064c6bb04b2 (diff) | |
| download | tinycc-07fd82b4113c9f912383dff448e3dd8b71179b7b.tar.gz tinycc-07fd82b4113c9f912383dff448e3dd8b71179b7b.tar.bz2 | |
Make alignments for struct arguments 8 bytes
The ABI (http://www.x86-64.org/documentation/abi.pdf) says
"The size of each argument gets rounded up to eightbytes"
| -rw-r--r-- | x86_64-gen.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/x86_64-gen.c b/x86_64-gen.c index a0c8280..7c64f3b 100644 --- a/x86_64-gen.c +++ b/x86_64-gen.c @@ -821,7 +821,7 @@ void gfunc_call(int nb_args) for(i = 0; i < nb_args; i++) { if ((vtop[-i].type.t & VT_BTYPE) == VT_STRUCT) { args_size += type_size(&vtop[-i].type, &align); - args_size = (args_size + 3) & ~3; + args_size = (args_size + 7) & ~7; } else if ((vtop[-i].type.t & VT_BTYPE) == VT_LDOUBLE) { args_size += 16; } else if (is_sse_float(vtop[-i].type.t)) { @@ -855,7 +855,7 @@ void gfunc_call(int nb_args) if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) { size = type_size(&vtop->type, &align); /* align to stack align size */ - size = (size + 3) & ~3; + size = (size + 7) & ~7; /* allocate the necessary size on stack */ o(0x48); oad(0xec81, size); /* sub $xxx, %rsp */ @@ -999,7 +999,7 @@ void gfunc_prolog(CType *func_type) } } else if ((type->t & VT_BTYPE) == VT_STRUCT) { size = type_size(type, &align); - size = (size + 3) & ~3; + size = (size + 7) & ~7; seen_stack_size += size; } else if ((type->t & VT_BTYPE) == VT_LDOUBLE) { seen_stack_size += LDOUBLE_SIZE; @@ -1058,7 +1058,7 @@ void gfunc_prolog(CType *func_type) while ((sym = sym->next) != NULL) { type = &sym->type; size = type_size(type, &align); - size = (size + 3) & ~3; + size = (size + 7) & ~7; if (is_sse_float(type->t)) { if (sse_param_index < 8) { /* save arguments passed by register */ |
