summaryrefslogtreecommitdiffhomepage
path: root/ir/be/mips
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2018-03-23 13:00:13 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2018-03-23 13:47:24 +0100
commit8948846ef4e0a5bd9d016ffe4677d9cd60ccf9b5 (patch)
tree624c7e58bdd3edc4d6d1e00d74a4894b90a0ec0b /ir/be/mips
parent4f5faa5db18da79edaee7ed2c6eca498a4510d8c (diff)
mips: Replace magic number '4' by a symbolic constant (number of GP register parameters).
Diffstat (limited to 'ir/be/mips')
-rw-r--r--ir/be/mips/mips_cconv.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ir/be/mips/mips_cconv.c b/ir/be/mips/mips_cconv.c
index e45f770..93b6f7d 100644
--- a/ir/be/mips/mips_cconv.c
+++ b/ir/be/mips/mips_cconv.c
@@ -50,8 +50,9 @@ void mips_determine_calling_convention(mips_calling_convention_t *const cconv, i
} else {
params = 0;
}
- cconv->param_stack_size = MAX(4, gp_param) * (MIPS_MACHINE_SIZE / 8);
- cconv->n_mem_param = gp_param > 4 ? gp_param - 4 : 0;
+ size_t const n_reg_params = ARRAY_SIZE(regs_param_gp);
+ cconv->param_stack_size = MAX(n_reg_params, gp_param) * (MIPS_MACHINE_SIZE / 8);
+ cconv->n_mem_param = gp_param > n_reg_params ? gp_param - n_reg_params : 0;
cconv->parameters = params;
/* Handle results. */