| ... | ... | @@ -3180,17 +3180,18 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro |
| 3180 | 3180 | // TODO optimize the register allocation |
| 3181 | 3181 | const regs = try self.register_manager.allocRegs(5, .{ null, null, null, null, null }, &.{}); |
| 3182 | 3182 | const src_reg = regs[0]; |
| 3183 | | const dst_reg = regs[2]; |
| 3183 | const dst_reg = regs[1]; |
| 3184 | 3184 | const len_reg = regs[2]; |
| 3185 | 3185 | const count_reg = regs[3]; |
| 3186 | 3186 | const tmp_reg = regs[4]; |
| 3187 | 3187 | |
| 3188 | | // add src_reg, fp, #off |
| 3189 | | const src_offset_op: Instruction.Operand = if (Instruction.Operand.fromU32(off)) |x| x else { |
| 3188 | // sub src_reg, fp, #off |
| 3189 | const adj_src_offset = off + @intCast(u32, ty.abiSize(self.target.*)); |
| 3190 | const src_offset_op: Instruction.Operand = if (Instruction.Operand.fromU32(adj_src_offset)) |x| x else { |
| 3190 | 3191 | return self.fail("TODO load: set reg to stack offset with all possible offsets", .{}); |
| 3191 | 3192 | }; |
| 3192 | 3193 | _ = try self.addInst(.{ |
| 3193 | | .tag = .add, |
| 3194 | .tag = .sub, |
| 3194 | 3195 | .cond = .al, |
| 3195 | 3196 | .data = .{ .rr_op = .{ |
| 3196 | 3197 | .rd = src_reg, |
| ... | ... | @@ -3200,8 +3201,8 @@ fn genSetStack(self: *Self, ty: Type, stack_offset: u32, mcv: MCValue) InnerErro |
| 3200 | 3201 | }); |
| 3201 | 3202 | |
| 3202 | 3203 | // sub dst_reg, fp, #stack_offset |
| 3203 | | const adj_stack_offset = stack_offset + @intCast(u32, ty.abiSize(self.target.*)); |
| 3204 | | const dst_offset_op: Instruction.Operand = if (Instruction.Operand.fromU32(adj_stack_offset)) |x| x else { |
| 3204 | const adj_dst_offset = stack_offset + @intCast(u32, ty.abiSize(self.target.*)); |
| 3205 | const dst_offset_op: Instruction.Operand = if (Instruction.Operand.fromU32(adj_dst_offset)) |x| x else { |
| 3205 | 3206 | return self.fail("TODO load: set reg to stack offset with all possible offsets", .{}); |
| 3206 | 3207 | }; |
| 3207 | 3208 | _ = try self.addInst(.{ |