Struct packing in register is now handled since commit 2bbfaf43 by tccgen.c proper.
Unified · Split
| @@ -1133,7 +1133,7 @@ static int copy_params(int nb_args, struct plan *plan, int todo) · 1132 unmodified lines | ||
| 1133 | 1133 | parameters and the function address. */ |
| 1134 | 1134 | void gfunc_call(int nb_args) |
| 1135 | 1135 | { |
| 1136 | − int align, r, args_size; | |
| 1136 | + int r, args_size; | |
| 1137 | 1137 | int variadic; |
| 1138 | 1138 | int todo; |
| 1139 | 1139 | struct plan plan; |
| @@ -1145,19 +1145,6 @@ void gfunc_call(int nb_args) · 5 unmodified lines | ||
| 1145 | 1145 | r = vtop->r & VT_VALMASK; |
| 1146 | 1146 | if (r == VT_CMP || (r & ~1) == VT_JMP) |
| 1147 | 1147 | gv(RC_INT); |
| 1148 | −#ifdef TCC_ARM_EABI | |
| 1149 | − /* return type is a struct so caller of gfunc_call (unary(void) in tccgen.c) | |
| 1150 | − assumed it had to be passed by a pointer. Since it's less than 4 bytes, we | |
| 1151 | − can actually pass it directly in a register. */ | |
| 1152 | − if((vtop[-nb_args].type.ref->type.t & VT_BTYPE) == VT_STRUCT | |
| 1153 | − && type_size(&vtop[-nb_args].type.ref->type, &align) <= 4) { | |
| 1154 | − SValue tmp; | |
| 1155 | − tmp=vtop[-nb_args]; | |
| 1156 | − vtop[-nb_args]=vtop[-nb_args+1]; | |
| 1157 | − vtop[-nb_args+1]=tmp; | |
| 1158 | − --nb_args; | |
| 1159 | − } | |
| 1160 | −#endif | |
| 1161 | 1148 | |
| 1162 | 1149 | args_size = assign_regs(nb_args, variadic, &plan, &todo); |
| 1163 | 1150 | |
| @@ -1177,16 +1164,11 @@ void gfunc_call(int nb_args) · 13 unmodified lines | ||
| 1177 | 1164 | if (args_size) |
| 1178 | 1165 | gadd_sp(args_size); /* pop all parameters passed on the stack */ |
| 1179 | 1166 | #ifdef TCC_ARM_EABI |
| 1180 | − if((vtop->type.ref->type.t & VT_BTYPE) == VT_STRUCT | |
| 1181 | − && type_size(&vtop->type.ref->type, &align) <= 4) { | |
| 1182 | − store(REG_IRET,vtop-nb_args-1); | |
| 1183 | − nb_args++; | |
| 1184 | − } | |
| 1185 | 1167 | #ifdef TCC_ARM_VFP |
| 1186 | 1168 | #ifdef TCC_ARM_HARDFLOAT |
| 1187 | − else if(variadic && is_float(vtop->type.ref->type.t)) { | |
| 1169 | + if(variadic && is_float(vtop->type.ref->type.t)) { | |
| 1188 | 1170 | #else |
| 1189 | − else if(is_float(vtop->type.ref->type.t)) { | |
| 1171 | + rf(is_float(vtop->type.ref->type.t)) { | |
| 1190 | 1172 | #endif |
| 1191 | 1173 | if((vtop->type.ref->type.t & VT_BTYPE) == VT_FLOAT) { |
| 1192 | 1174 | o(0xEE000A10); /*vmov s0, r0 */ |