Skip to content

Commit

Permalink
chore(ssa): rename codegen to ssa_gen + reorg of Value struct (#797)
Browse files Browse the repository at this point in the history
* [multi]

- move value into its own module
- remove _ from match clause

* move IRGenerator impl into code_gen.rs

* rename codegen to ssa_gen

* rename codegen methods to ssa_gen

* Revert "[multi]" + git magic

This reverts commit cd78b1b.

* Fix incorrect description

* - rename `Single` to `Node
- slight change to the error messages

* resolve merge
  • Loading branch information
kevaundray authored Feb 11, 2023
1 parent 79d34fc commit 1f2d2b7
Show file tree
Hide file tree
Showing 5 changed files with 197 additions and 168 deletions.
4 changes: 2 additions & 2 deletions crates/noirc_evaluator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use errors::{RuntimeError, RuntimeErrorKind};
use iter_extended::btree_map;
use noirc_abi::{AbiType, AbiVisibility};
use noirc_frontend::monomorphization::ast::*;
use ssa::{code_gen::IRGenerator, node};
use ssa::{node, ssa_gen::IRGenerator};
use std::collections::BTreeMap;

pub struct Evaluator {
Expand Down Expand Up @@ -114,7 +114,7 @@ impl Evaluator {
self.parse_abi_alt(&mut ir_gen);

// Now call the main function
ir_gen.codegen_main()?;
ir_gen.ssa_gen_main()?;

//Generates ACIR representation:
ir_gen.context.ir_to_acir(self, enable_logging)?;
Expand Down
8 changes: 4 additions & 4 deletions crates/noirc_evaluator/src/ssa/function.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use crate::errors::RuntimeError;
use crate::ssa::{
block::BlockId,
code_gen::IRGenerator,
conditional::{AssumptionId, DecisionTree, TreeBuilder},
context::SsaContext,
mem::ArrayId,
node::{Node, NodeId, ObjectType, Opcode, Operation},
ssa_gen::IRGenerator,
{block, builtin, node, ssa_form},
};
use iter_extended::try_vecmap;
Expand Down Expand Up @@ -173,7 +173,7 @@ impl IRGenerator {
self.context.functions.insert(func_id, func.clone());

let function_body = self.program.take_function_body(func_id);
let last_value = self.codegen_expression(&function_body)?;
let last_value = self.ssa_gen_expression(&function_body)?;
let return_values = last_value.to_node_ids();

func.result_types.clear();
Expand Down Expand Up @@ -227,8 +227,8 @@ impl IRGenerator {

//generates an instruction for calling the function
pub fn call(&mut self, call: &Call) -> Result<Vec<NodeId>, RuntimeError> {
let func = self.codegen_expression(&call.func)?.unwrap_id();
let arguments = self.codegen_expression_list(&call.arguments);
let func = self.ssa_gen_expression(&call.func)?.unwrap_id();
let arguments = self.ssa_gen_expression_list(&call.arguments);

if let Some(opcode) = self.context.get_builtin_opcode(func) {
return self.call_low_level(opcode, arguments);
Expand Down
3 changes: 2 additions & 1 deletion crates/noirc_evaluator/src/ssa/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ pub mod acir_gen;
mod anchor;
mod block;
mod builtin;
pub mod code_gen;
mod conditional;
mod context;
mod flatten;
Expand All @@ -13,3 +12,5 @@ mod mem;
pub mod node;
mod optimizations;
mod ssa_form;
pub mod ssa_gen;
mod value;
Loading

0 comments on commit 1f2d2b7

Please sign in to comment.