We need to preserve the type of the pointer to the structure, f.ex. when a global structure is returned. This is not a perfect solution. Registers loaded in the first iteration might be overwritten in a following iteration as the register is no longer on vtop. This is not a problem for ARM32 as gfunc_sret returns a maximum of 1 in the integer case.
Unified · Split
| @@ -5111,16 +5111,21 @@ static void block(int *bsym, int *csym, int is_expr) · 5110 unmodified lines | |||
| 5111 | else | 5111 | else |
| 5112 | r = RC_IRET; | 5112 | r = RC_IRET; |
| 5113 | 5113 | ||
| 5114 | for (;;) { | 5114 | if (ret_nregs == 1) |
| 5115 | gv(r); | 5115 | gv(r); |
| 5116 | if (--ret_nregs == 0) | 5116 | else { |
| 5117 | break; | 5117 | for (;;) { |
| 5118 | /* We assume that when a structure is returned in multiple | 5118 | vdup(); |
| 5119 | registers, their classes are consecutive values of the | 5119 | gv(r); |
| 5120 | suite s(n) = 2^n */ | 5120 | vpop(); |
| 5121 | r <<= 1; | 5121 | if (--ret_nregs == 0) |
| 5122 | vtop->c.i += regsize; | 5122 | break; |
| 5123 | vtop->r = VT_LOCAL | VT_LVAL; | 5123 | /* We assume that when a structure is returned in multiple |
| 5124 | registers, their classes are consecutive values of the | ||
| 5125 | suite s(n) = 2^n */ | ||
| 5126 | r <<= 1; | ||
| 5127 | vtop->c.i += regsize; | ||
| 5128 | } | ||
| 5124 | } | 5129 | } |
| 5125 | } | 5130 | } |
| 5126 | } else if (is_float(func_vt.t)) { | 5131 | } else if (is_float(func_vt.t)) { |