authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-01-01 23:49:23+01:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-01-04 01:21:23+01:00
log4590820c4cd8c2e3fc2da2cf0e3fda632b8f17eb
tree4d9f172757682dccb90535f3b80a4f252f72e16b
parentaeff635863e9a87a082109a69e38fe0aa9e32f54

stage2: implement slice_len for slices on the stack


1 files changed, 8 insertions(+), 4 deletions(-)

src/arch/x86_64/CodeGen.zig+8-4
...@@ -1261,10 +1261,14 @@ fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void {...@@ -1261,10 +1261,14 @@ fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void {
12611261
1262fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void {1262fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void {
1263 const ty_op = self.air.instructions.items(.data)[inst].ty_op;1263 const ty_op = self.air.instructions.items(.data)[inst].ty_op;
1264 const result: MCValue = if (self.liveness.isUnused(inst))1264 const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
1265 .dead1265 const operand = try self.resolveInst(ty_op.operand);
1266 else1266 const dst_mcv: MCValue = switch (operand) {
1267 return self.fail("TODO implement slice_len for {}", .{self.target.cpu.arch});1267 .stack_offset => |off| MCValue{ .stack_offset = off + 4 },
1268 else => return self.fail("TODO implement slice_len for {}", .{operand}),
1269 };
1270 break :result dst_mcv;
1271 };
1268 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });1272 return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
1269}1273}
12701274