| ... | @@ -1255,10 +1255,18 @@ fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1255,10 +1255,18 @@ fn airWrapErrUnionErr(self: *Self, inst: Air.Inst.Index) !void { |
| 1255 | | 1255 | |
| 1256 | fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void { | 1256 | fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void { |
| 1257 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 1257 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 1258 | const result: MCValue = if (self.liveness.isUnused(inst)) | 1258 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1259 | .dead | 1259 | const operand = try self.resolveInst(ty_op.operand); |
| 1260 | else | 1260 | const dst_mcv: MCValue = blk: { |
| 1261 | return self.fail("TODO implement slice_ptr for {}", .{self.target.cpu.arch}); | 1261 | switch (operand) { |
| | 1262 | .stack_offset => |off| { |
| | 1263 | break :blk MCValue{ .stack_offset = off }; |
| | 1264 | }, |
| | 1265 | else => return self.fail("TODO implement slice_ptr for {}", .{operand}), |
| | 1266 | } |
| | 1267 | }; |
| | 1268 | break :result dst_mcv; |
| | 1269 | }; |
| 1262 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); | 1270 | return self.finishAir(inst, result, .{ ty_op.operand, .none, .none }); |
| 1263 | } | 1271 | } |
| 1264 | | 1272 | |
| ... | @@ -1266,9 +1274,13 @@ fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void { | ... | @@ -1266,9 +1274,13 @@ fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void { |
| 1266 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; | 1274 | const ty_op = self.air.instructions.items(.data)[inst].ty_op; |
| 1267 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { | 1275 | const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: { |
| 1268 | const operand = try self.resolveInst(ty_op.operand); | 1276 | const operand = try self.resolveInst(ty_op.operand); |
| 1269 | const dst_mcv: MCValue = switch (operand) { | 1277 | const dst_mcv: MCValue = blk: { |
| 1270 | .stack_offset => |off| MCValue{ .stack_offset = off + 8 }, | 1278 | switch (operand) { |
| 1271 | else => return self.fail("TODO implement slice_len for {}", .{operand}), | 1279 | .stack_offset => |off| { |
| | 1280 | break :blk MCValue{ .stack_offset = off + 8 }; |
| | 1281 | }, |
| | 1282 | else => return self.fail("TODO implement slice_len for {}", .{operand}), |
| | 1283 | } |
| 1272 | }; | 1284 | }; |
| 1273 | break :result dst_mcv; | 1285 | break :result dst_mcv; |
| 1274 | }; | 1286 | }; |