diff --git a/crates/noirc_evaluator/src/ssa_refactor.rs b/crates/noirc_evaluator/src/ssa_refactor.rs index fc45071e579..a55f61f71d6 100644 --- a/crates/noirc_evaluator/src/ssa_refactor.rs +++ b/crates/noirc_evaluator/src/ssa_refactor.rs @@ -7,6 +7,18 @@ //! This module heavily borrows from Cranelift #![allow(dead_code)] +use noirc_frontend::monomorphization::ast::Program; + +use self::acir_gen::Acir; + +mod acir_gen; mod ir; mod ssa_builder; pub mod ssa_gen; + +/// Optimize the given program by converting it into SSA +/// form and performing optimizations there. When finished, +/// convert the final SSA into ACIR and return it. +pub fn optimize_into_acir(program: Program) -> Acir { + ssa_gen::generate_ssa(program).into_acir() +} diff --git a/crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs b/crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs new file mode 100644 index 00000000000..a0959db5db8 --- /dev/null +++ b/crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs @@ -0,0 +1,26 @@ +//! This file holds the pass to convert from Noir's SSA IR to ACIR. +use super::ssa_gen::Ssa; + +/// Context struct for the acir generation pass. +/// May be similar to the Evaluator struct in the current SSA IR. +struct Context {} + +/// The output of the Acir-gen pass +pub struct Acir {} + +impl Ssa { + pub(crate) fn into_acir(self) -> Acir { + let mut context = Context::new(); + context.convert_ssa(self) + } +} + +impl Context { + fn new() -> Self { + Self {} + } + + fn convert_ssa(&mut self, _ssa: Ssa) -> Acir { + todo!() + } +}