From 5e7095ef3416d903c92f3f0e068f105bc4b475a7 Mon Sep 17 00:00:00 2001 From: David Mak Date: Wed, 14 Aug 2024 18:17:25 +0800 Subject: [PATCH] WIP - [artiq] only change slot --- nac3artiq/src/codegen.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nac3artiq/src/codegen.rs b/nac3artiq/src/codegen.rs index 2046b685..ba2b0580 100644 --- a/nac3artiq/src/codegen.rs +++ b/nac3artiq/src/codegen.rs @@ -680,7 +680,14 @@ fn format_rpc_ret<'ctx>( // } _ => { - let slot = ctx.builder.build_alloca(llvm_ret_ty, "rpc.ret.slot").unwrap(); + let llvm_usize = generator.get_size_type(ctx.ctx); + + let _slot = ctx.builder.build_alloca(llvm_ret_ty, "rpc.ret.slot").unwrap(); + let slot = if matches!(&*ctx.unifier.get_ty_immutable(ret_ty), TypeEnum::TObj { obj_id, .. } if *obj_id == PrimDef::NDArray.id()) { + ctx.builder.build_array_alloca(llvm_i8, llvm_usize.const_int(8, false), "").unwrap() + } else { + _slot + }; let slotgen = ctx.builder.build_bitcast(slot, llvm_pi8, "rpc.ret.ptr").unwrap(); ctx.builder.build_unconditional_branch(head_bb).unwrap(); ctx.builder.position_at_end(head_bb);