riscv: implement ptr_slice_ptr_ptr

just one step closer to allocation
This commit is contained in:
David Rubin 2024-07-05 23:00:55 -07:00
parent 93e9c7a963
commit c78ebeb44c
No known key found for this signature in database
GPG Key ID: A4390FEB5F00C0A5
2 changed files with 8 additions and 2 deletions

View File

@ -776,6 +776,7 @@ pub fn default_panic(msg: []const u8, error_return_trace: ?*StackTrace, ret_addr
if (builtin.zig_backend == .stage2_riscv64) {
std.debug.print("panic: {s}\n", .{msg});
@breakpoint();
std.posix.exit(127);
}

View File

@ -3433,8 +3433,13 @@ fn airPtrSliceLenPtr(func: *Func, inst: Air.Inst.Index) !void {
fn airPtrSlicePtrPtr(func: *Func, inst: Air.Inst.Index) !void {
const ty_op = func.air.instructions.items(.data)[@intFromEnum(inst)].ty_op;
const result: MCValue = if (func.liveness.isUnused(inst)) .unreach else return func.fail("TODO implement ptr_slice_ptr_ptr for {}", .{func.target.cpu.arch});
return func.finishAir(inst, result, .{ ty_op.operand, .none, .none });
const opt_mcv = try func.resolveInst(ty_op.operand);
const dst_mcv = if (func.reuseOperand(inst, ty_op.operand, 0, opt_mcv))
opt_mcv
else
try func.copyToNewRegister(inst, opt_mcv);
return func.finishAir(inst, dst_mcv, .{ ty_op.operand, .none, .none });
}
fn airSliceElemVal(func: *Func, inst: Air.Inst.Index) !void {