WIP - [artiq] Double indirection?

This commit is contained in:
David Mak 2024-08-15 12:08:10 +08:00
parent 4ac60b4fc9
commit d91fae90d0
1 changed files with 15 additions and 1 deletions

View File

@ -549,6 +549,7 @@ fn format_rpc_ret<'ctx>(
let llvm_i8 = ctx.ctx.i8_type();
let llvm_i32 = ctx.ctx.i32_type();
let llvm_pi8 = llvm_i8.ptr_type(AddressSpace::default());
let llvm_ppi8 = llvm_pi8.ptr_type(AddressSpace::default());
let rpc_recv = ctx.module.get_function("rpc_recv").unwrap_or_else(|| {
ctx.module.add_function("rpc_recv", llvm_i32.fn_type(&[llvm_pi8.into()], false), None)
@ -667,10 +668,23 @@ fn format_rpc_ret<'ctx>(
// .unwrap()
// .into_pointer_value();
// ndarray.store_data(ctx, data_ptr);
let data_addr = phi.as_basic_value().into_pointer_value();
let data_addr = ctx
.builder
.build_load(
ctx.builder
.build_bitcast(data_addr, llvm_ppi8, "")
.unwrap()
.into_pointer_value(),
"",
)
.unwrap()
.into_pointer_value();
call_memcpy_generic(
ctx,
ndarray.ptr_to_data(ctx),
phi.as_basic_value().into_pointer_value(),
data_addr,
llvm_pdata_sizeof,
llvm_i1.const_zero(),
);