Skip to content

Commit

Permalink
chore(ssa refactor): Add entry point for acir gen pass (#1285)
Browse files Browse the repository at this point in the history
* Add entry point for acir gen pass

* Fix typo
  • Loading branch information
jfecher authored May 3, 2023
1 parent e739329 commit 80f436d
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/noirc_evaluator/src/ssa_refactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
26 changes: 26 additions & 0 deletions crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs
Original file line number Diff line number Diff line change
@@ -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!()
}
}

0 comments on commit 80f436d

Please sign in to comment.