Add a comment in arm-gen.c to explain how commit 41ce391c86df135609af33658414d4d452c5beb3 solves the register corruption when passing a structure in a function call.
Unified · Split
| @@ -1127,7 +1127,10 @@ static int copy_params(int nb_args, struct plan *plan, int todo) · 1126 unmodified lines | ||
| 1127 | 1127 | for(pplan = plan->clsplans[CORE_STRUCT_CLASS]; pplan; pplan = pplan->prev) { |
| 1128 | 1128 | int r; |
| 1129 | 1129 | pplan->sval->r = pplan->start; |
| 1130 | − /* TODO: why adding fake param */ | |
| 1130 | + /* An SValue can only pin 2 registers at best (r and r2) but a structure | |
| 1131 | + can occupy more than 2 registers. Thus, we need to push on the value | |
| 1132 | + stack some fake parameter to have on SValue for each registers used | |
| 1133 | + by a structure (r2 is not used). */ | |
| 1131 | 1134 | for (r = pplan->start + 1; r <= pplan->end; r++) { |
| 1132 | 1135 | if (todo & (1 << r)) { |
| 1133 | 1136 | nb_extra_sval++; |