Skip to content

Commit

Permalink
Add Index to store place
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Apr 26, 2024
1 parent f800fd3 commit f92aeb9
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion crates/concrete_codegen_mlir/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,31 @@ fn compile_store_place<'c: 'b, 'b>(
_ => unreachable!(),
}
}
PlaceElem::Index(_) => todo!(),
PlaceElem::Index(local) => {
local_ty = match local_ty.kind {
TyKind::Array(inner, _) => *inner,
_ => unreachable!(),
};

let place = Place {
local: *local,
projection: vec![],
};

let (index, _) = compile_load_place(ctx, block, &place, locals)?;

ptr = block
.append_operation(llvm::get_element_ptr_dynamic(
ctx.context(),
ptr,
&[index],
compile_type(ctx.module_ctx, &local_ty),
opaque_pointer(ctx.context()),
Location::unknown(ctx.context()),
))
.result(0)?
.into();
}
PlaceElem::ConstantIndex(index) => {
local_ty = match local_ty.kind {
TyKind::Array(inner, _) => *inner,
Expand Down

0 comments on commit f92aeb9

Please sign in to comment.