From 82b257c29cc24e561fd29a0374fcda73feb5d760 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Mon, 25 Nov 2013 11:00:51 +0800 Subject: [PATCH] Add comment to explain the code added by 41ce391c Add a comment in arm-gen.c to explain how commit 41ce391c86df135609af33658414d4d452c5beb3 solves the register corruption when passing a structure in a function call. --- arm-gen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arm-gen.c b/arm-gen.c index 8b077084..c22e98e5 100644 --- a/arm-gen.c +++ b/arm-gen.c @@ -1127,7 +1127,10 @@ static int copy_params(int nb_args, struct plan *plan, int todo) for(pplan = plan->clsplans[CORE_STRUCT_CLASS]; pplan; pplan = pplan->prev) { int r; pplan->sval->r = pplan->start; - /* TODO: why adding fake param */ + /* An SValue can only pin 2 registers at best (r and r2) but a structure + can occupy more than 2 registers. Thus, we need to push on the value + stack some fake parameter to have on SValue for each registers used + by a structure (r2 is not used). */ for (r = pplan->start + 1; r <= pplan->end; r++) { if (todo & (1 << r)) { nb_extra_sval++; -- 2.11.4.GIT