Skip to content

Commit

Permalink
Add a GEP method to blockext, simply some code (#873)
Browse files Browse the repository at this point in the history
* Add a GEP method to blockext

* better

* missed

* check

* more improvement

* small fix

* small opt

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>
  • Loading branch information
edg-l and JulianGCalderon authored Oct 28, 2024
1 parent 4e8af66 commit c0d417b
Show file tree
Hide file tree
Showing 8 changed files with 1,090 additions and 2,144 deletions.
11 changes: 5 additions & 6 deletions src/libfuncs/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::{
drop_overrides::DropOverridesMeta, realloc_bindings::ReallocBindingsMeta, MetadataStorage,
},
types::TypeBuilder,
utils::{BlockExt, ProgramRegistryExt},
utils::{BlockExt, GepIndex, ProgramRegistryExt},
};
use cairo_lang_sierra::{
extensions::{
Expand Down Expand Up @@ -479,14 +479,13 @@ pub fn build_get<'ctx, 'this>(
let elem_offset =
valid_block.append_op_result(arith::muli(elem_stride, index, location))?;

let elem_ptr = valid_block.append_op_result(llvm::get_element_ptr_dynamic(
let elem_ptr = valid_block.gep(
context,
location,
ptr,
&[elem_offset],
&[GepIndex::Value(elem_offset)],
IntegerType::new(context, 8).into(),
llvm::r#type::pointer(context, 0),
location,
))?;
)?;

let elem_size = valid_block.const_int(context, location, elem_layout.size(), 64)?;

Expand Down
Loading

0 comments on commit c0d417b

Please sign in to comment.