Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small refactor with BlockExt #939

Merged
merged 16 commits into from
Nov 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ fn compile_func(
block.append_operation(llvm::store(
context,
ptr,
pre_entry_block.argument(0)?.into(),
pre_entry_block.arg(0)?,
location,
LoadStoreOptions::new().align(Some(IntegerAttribute::new(
IntegerType::new(context, 64).into(),
Expand Down
351 changes: 107 additions & 244 deletions src/libfuncs/array.rs

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions src/libfuncs/bitwise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ pub fn build<'ctx, 'this>(
_metadata: &mut MetadataStorage,
_info: &SignatureOnlyConcreteLibfunc,
) -> Result<()> {
let bitwise =
super::increment_builtin_counter(context, entry, location, entry.argument(0)?.into())?;
let bitwise = super::increment_builtin_counter(context, entry, location, entry.arg(0)?)?;

let lhs = entry.argument(1)?.into();
let rhs = entry.argument(2)?.into();
let lhs = entry.arg(1)?;
let rhs = entry.arg(2)?;

let logical_and = entry.append_op_result(arith::andi(lhs, rhs, location))?;
let logical_xor = entry.append_op_result(arith::xori(lhs, rhs, location))?;
Expand Down
10 changes: 5 additions & 5 deletions src/libfuncs/bool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ fn build_bool_binary<'ctx, 'this>(
.trailing_zeros();
let tag_ty = IntegerType::new(context, tag_bits).into();

let lhs = entry.argument(0)?.into();
let rhs = entry.argument(1)?.into();
let lhs = entry.arg(0)?;
let rhs = entry.arg(1)?;

let lhs_tag = entry.extract_value(context, location, lhs, tag_ty, 0)?;

Expand Down Expand Up @@ -149,7 +149,7 @@ pub fn build_bool_not<'ctx, 'this>(
.trailing_zeros();
let tag_ty = IntegerType::new(context, tag_bits).into();

let value = entry.argument(0)?.into();
let value = entry.arg(0)?;
let tag_value = entry.extract_value(context, location, value, tag_ty, 0)?;

let const_1 = entry.const_int_from_type(context, location, 1, tag_ty)?;
Expand Down Expand Up @@ -199,10 +199,10 @@ pub fn build_bool_to_felt252<'ctx, 'this>(
.trailing_zeros();
let tag_ty = IntegerType::new(context, tag_bits).into();

let value = entry.argument(0)?.into();
let value = entry.arg(0)?;
let tag_value = entry.extract_value(context, location, value, tag_ty, 0)?;

let result = entry.append_op_result(arith::extui(tag_value, felt252_ty, location))?;
let result = entry.extui(tag_value, felt252_ty, location)?;

entry.append_operation(helper.br(0, &[result], location));
Ok(())
Expand Down
Loading
Loading