Skip to content

Commit

Permalink
chore: Remove usage of acvm::default_is_opcode_supported (#1366)
Browse files Browse the repository at this point in the history
Co-authored-by: Blaine Bublitz <blaine.bublitz@gmail.com>
Co-authored-by: Tom French <tom@tomfren.ch>
  • Loading branch information
3 people authored May 23, 2023
1 parent 6a2330c commit 8ca4ec6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/nargo_cli/src/cli/check_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ fn check_from_path<B: Backend, P: AsRef<Path>>(
let mut driver = Resolver::resolve_root_manifest(
p.as_ref(),
backend.np_language(),
#[allow(deprecated)]
Box::new(acvm::default_is_opcode_supported(backend.np_language())),
// TODO: Remove need for driver to be aware of backend.
Box::new(|op| B::default().supports_opcode(op)),
)?;

driver.check_crate(compile_options).map_err(|_| CliError::CompilationError)?;
Expand Down
4 changes: 2 additions & 2 deletions crates/nargo_cli/src/cli/compile_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ fn setup_driver<B: Backend>(
Resolver::resolve_root_manifest(
program_dir,
backend.np_language(),
#[allow(deprecated)]
Box::new(acvm::default_is_opcode_supported(backend.np_language())),
// TODO: Remove need for driver to be aware of backend.
Box::new(|op| B::default().supports_opcode(op)),
)
}

Expand Down
4 changes: 2 additions & 2 deletions crates/nargo_cli/src/cli/test_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ fn run_tests<B: Backend>(
let mut driver = Resolver::resolve_root_manifest(
program_dir,
backend.np_language(),
#[allow(deprecated)]
Box::new(acvm::default_is_opcode_supported(backend.np_language())),
// TODO: Remove need for driver to be aware of backend.
Box::new(|op| B::default().supports_opcode(op)),
)?;

driver.check_crate(compile_options).map_err(|_| CliError::CompilationError)?;
Expand Down
8 changes: 2 additions & 6 deletions crates/noirc_driver/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ pub use program::CompiledProgram;
pub struct Driver {
context: Context,
language: Language,
// We retain this as we need to pass this into `create_circuit` once signature is updated to allow.
#[allow(dead_code)]
is_opcode_supported: Box<dyn Fn(&Opcode) -> bool>,
}

Expand Down Expand Up @@ -286,22 +284,20 @@ impl Driver {
let program = monomorphize(main_function, &self.context.def_interner);

let np_language = self.language.clone();
// TODO: use proper `is_opcode_supported` implementation.
let is_opcode_supported = acvm::default_is_opcode_supported(np_language.clone());

let circuit_abi = if options.experimental_ssa {
experimental_create_circuit(
program,
np_language,
is_opcode_supported,
&self.is_opcode_supported,
options.show_ssa,
options.show_output,
)
} else {
create_circuit(
program,
np_language,
is_opcode_supported,
&self.is_opcode_supported,
options.show_ssa,
options.show_output,
)
Expand Down
2 changes: 1 addition & 1 deletion crates/noirc_evaluator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub struct Evaluator {
pub fn create_circuit(
program: Program,
np_language: Language,
is_opcode_supported: fn(&AcirOpcode) -> bool,
is_opcode_supported: &impl Fn(&AcirOpcode) -> bool,
enable_logging: bool,
show_output: bool,
) -> Result<(Circuit, Abi), RuntimeError> {
Expand Down
4 changes: 2 additions & 2 deletions crates/noirc_evaluator/src/ssa_refactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use crate::errors::RuntimeError;
use acvm::{
acir::circuit::{Circuit, Opcode},
acir::circuit::{Circuit, Opcode as AcirOpcode},
Language,
};
use noirc_abi::Abi;
Expand All @@ -36,7 +36,7 @@ pub fn optimize_into_acir(program: Program) -> Acir {
pub fn experimental_create_circuit(
_program: Program,
_np_language: Language,
_is_opcode_supported: fn(&Opcode) -> bool,
_is_opcode_supported: &impl Fn(&AcirOpcode) -> bool,
_enable_logging: bool,
_show_output: bool,
) -> Result<(Circuit, Abi), RuntimeError> {
Expand Down

0 comments on commit 8ca4ec6

Please sign in to comment.