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"
This commit is contained in:
parent
83f0a7b6f8
commit
07fd82b411
1 changed files with 4 additions and 4 deletions
|
|
@ -821,7 +821,7 @@ void gfunc_call(int nb_args)
|
||||||
for(i = 0; i < nb_args; i++) {
|
for(i = 0; i < nb_args; i++) {
|
||||||
if ((vtop[-i].type.t & VT_BTYPE) == VT_STRUCT) {
|
if ((vtop[-i].type.t & VT_BTYPE) == VT_STRUCT) {
|
||||||
args_size += type_size(&vtop[-i].type, &align);
|
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) {
|
} else if ((vtop[-i].type.t & VT_BTYPE) == VT_LDOUBLE) {
|
||||||
args_size += 16;
|
args_size += 16;
|
||||||
} else if (is_sse_float(vtop[-i].type.t)) {
|
} 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) {
|
if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) {
|
||||||
size = type_size(&vtop->type, &align);
|
size = type_size(&vtop->type, &align);
|
||||||
/* align to stack align size */
|
/* align to stack align size */
|
||||||
size = (size + 3) & ~3;
|
size = (size + 7) & ~7;
|
||||||
/* allocate the necessary size on stack */
|
/* allocate the necessary size on stack */
|
||||||
o(0x48);
|
o(0x48);
|
||||||
oad(0xec81, size); /* sub $xxx, %rsp */
|
oad(0xec81, size); /* sub $xxx, %rsp */
|
||||||
|
|
@ -999,7 +999,7 @@ void gfunc_prolog(CType *func_type)
|
||||||
}
|
}
|
||||||
} else if ((type->t & VT_BTYPE) == VT_STRUCT) {
|
} else if ((type->t & VT_BTYPE) == VT_STRUCT) {
|
||||||
size = type_size(type, &align);
|
size = type_size(type, &align);
|
||||||
size = (size + 3) & ~3;
|
size = (size + 7) & ~7;
|
||||||
seen_stack_size += size;
|
seen_stack_size += size;
|
||||||
} else if ((type->t & VT_BTYPE) == VT_LDOUBLE) {
|
} else if ((type->t & VT_BTYPE) == VT_LDOUBLE) {
|
||||||
seen_stack_size += LDOUBLE_SIZE;
|
seen_stack_size += LDOUBLE_SIZE;
|
||||||
|
|
@ -1058,7 +1058,7 @@ void gfunc_prolog(CType *func_type)
|
||||||
while ((sym = sym->next) != NULL) {
|
while ((sym = sym->next) != NULL) {
|
||||||
type = &sym->type;
|
type = &sym->type;
|
||||||
size = type_size(type, &align);
|
size = type_size(type, &align);
|
||||||
size = (size + 3) & ~3;
|
size = (size + 7) & ~7;
|
||||||
if (is_sse_float(type->t)) {
|
if (is_sse_float(type->t)) {
|
||||||
if (sse_param_index < 8) {
|
if (sse_param_index < 8) {
|
||||||
/* save arguments passed by register */
|
/* save arguments passed by register */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue