mirror of
https://github.com/ziglang/zig.git
synced 2026-01-02 11:33:21 +00:00
stage2: implement slice_len for slices on the stack
This commit is contained in:
parent
aeff635863
commit
4590820c4c
@ -1261,10 +1261,14 @@ fn airSlicePtr(self: *Self, inst: Air.Inst.Index) !void {
|
||||
|
||||
fn airSliceLen(self: *Self, inst: Air.Inst.Index) !void {
|
||||
const ty_op = self.air.instructions.items(.data)[inst].ty_op;
|
||||
const result: MCValue = if (self.liveness.isUnused(inst))
|
||||
.dead
|
||||
else
|
||||
return self.fail("TODO implement slice_len for {}", .{self.target.cpu.arch});
|
||||
const result: MCValue = if (self.liveness.isUnused(inst)) .dead else result: {
|
||||
const operand = try self.resolveInst(ty_op.operand);
|
||||
const dst_mcv: MCValue = switch (operand) {
|
||||
.stack_offset => |off| MCValue{ .stack_offset = off + 4 },
|
||||
else => return self.fail("TODO implement slice_len for {}", .{operand}),
|
||||
};
|
||||
break :result dst_mcv;
|
||||
};
|
||||
return self.finishAir(inst, result, .{ ty_op.operand, .none, .none });
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user