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

chore(ssa refactor): Add entry point for acir gen pass #1285

Merged
merged 2 commits into from
May 3, 2023
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
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!()
}
}