Skip to content

Commit

Permalink
chore: rename ssa_refactor module to ssa (#2129)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Aug 2, 2023
1 parent 27ab78f commit a07b8a4
Show file tree
Hide file tree
Showing 42 changed files with 54 additions and 59 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ result
**/target
!crates/nargo_cli/tests/test_data/*/target
!crates/nargo_cli/tests/test_data/*/target/witness.tr
!crates/nargo_cli/tests/test_data_ssa_refactor/*/target
!crates/nargo_cli/tests/test_data_ssa_refactor/*/target/witness.tr
2 changes: 1 addition & 1 deletion crates/noirc_evaluator/src/brillig/brillig_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub(crate) mod brillig_directive;
pub(crate) mod brillig_fn;
pub(crate) mod brillig_slice_ops;

use crate::ssa_refactor::ir::{function::Function, post_order::PostOrder};
use crate::ssa::ir::{function::Function, post_order::PostOrder};

use std::collections::HashMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ use crate::brillig::brillig_gen::brillig_slice_ops::{
use crate::brillig::brillig_ir::{
BrilligBinaryOp, BrilligContext, BRILLIG_INTEGER_ARITHMETIC_BIT_SIZE,
};
use crate::ssa_refactor::ir::function::FunctionId;
use crate::ssa_refactor::ir::instruction::{Endian, Intrinsic};
use crate::ssa_refactor::ir::{
use crate::ssa::ir::{
basic_block::{BasicBlock, BasicBlockId},
dfg::DataFlowGraph,
instruction::{Binary, BinaryOp, Instruction, InstructionId, TerminatorInstruction},
function::FunctionId,
instruction::{
Binary, BinaryOp, Endian, Instruction, InstructionId, Intrinsic, TerminatorInstruction,
},
types::{NumericType, Type},
value::{Value, ValueId},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::{
artifact::{BrilligParameter, Label},
BrilligContext,
},
ssa_refactor::ir::{
ssa::ir::{
dfg::DataFlowGraph,
function::{Function, FunctionId},
types::{CompositeType, Type},
Expand Down
2 changes: 1 addition & 1 deletion crates/noirc_evaluator/src/brillig/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use self::{
brillig_gen::{brillig_fn::FunctionContext, convert_ssa_function},
brillig_ir::artifact::{BrilligArtifact, Label},
};
use crate::ssa_refactor::{
use crate::ssa::{
ir::{
function::{Function, FunctionId, RuntimeType},
value::Value,
Expand Down
4 changes: 2 additions & 2 deletions crates/noirc_evaluator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ mod errors;

// SSA code to create the SSA based IR
// for functions and execute different optimizations.
pub mod ssa_refactor;
pub mod ssa;

pub mod brillig;

pub use ssa_refactor::create_circuit;
pub use ssa::create_circuit;
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use super::generated_acir::GeneratedAcir;
use crate::brillig::brillig_gen::brillig_directive;
use crate::errors::{InternalError, RuntimeError};
use crate::ssa_refactor::acir_gen::{AcirDynamicArray, AcirValue};
use crate::ssa_refactor::ir::types::Type as SsaType;
use crate::ssa_refactor::ir::{instruction::Endian, types::NumericType};
use crate::ssa::acir_gen::{AcirDynamicArray, AcirValue};
use crate::ssa::ir::types::Type as SsaType;
use crate::ssa::ir::{instruction::Endian, types::NumericType};
use acvm::acir::circuit::opcodes::{BlockId, MemOp};
use acvm::acir::circuit::Opcode;
use acvm::acir::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1086,7 +1086,7 @@ mod tests {

use crate::{
brillig::Brillig,
ssa_refactor::{
ssa::{
ir::{function::RuntimeType, map::Id, types::Type},
ssa_builder::FunctionBuilder,
},
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ impl ControlFlowGraph {

#[cfg(test)]
mod tests {
use crate::ssa_refactor::ir::{instruction::TerminatorInstruction, map::Id, types::Type};
use crate::ssa::ir::{instruction::TerminatorInstruction, map::Id, types::Type};

use super::{super::function::Function, ControlFlowGraph};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{borrow::Cow, collections::HashMap};

use crate::ssa_refactor::ir::instruction::SimplifyResult;
use crate::ssa::ir::instruction::SimplifyResult;

use super::{
basic_block::{BasicBlock, BasicBlockId},
Expand Down Expand Up @@ -503,7 +503,7 @@ impl<'dfg> InsertInstructionResult<'dfg> {
#[cfg(test)]
mod tests {
use super::DataFlowGraph;
use crate::ssa_refactor::ir::instruction::Instruction;
use crate::ssa::ir::instruction::Instruction;

#[test]
fn make_instruction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ impl DominatorTree {
mod tests {
use std::cmp::Ordering;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::BasicBlockId,
dom::DominatorTree,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ use acvm::{acir::BlackBoxFunc, FieldElement};
use iter_extended::vecmap;
use num_bigint::BigUint;

use crate::ssa_refactor::ir::types::NumericType;

use super::{
basic_block::BasicBlockId,
dfg::DataFlowGraph,
map::Id,
types::Type,
types::{NumericType, Type},
value::{Value, ValueId},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use acvm::{acir::BlackBoxFunc, BlackBoxResolutionError, FieldElement};
use iter_extended::vecmap;
use num_bigint::BigUint;

use crate::ssa_refactor::ir::{
use crate::ssa::ir::{
dfg::DataFlowGraph,
instruction::Intrinsic,
map::Id,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use std::collections::HashSet;

use crate::ssa_refactor::ir::{basic_block::BasicBlockId, function::Function};
use crate::ssa::ir::{basic_block::BasicBlockId, function::Function};

/// Depth-first traversal stack state marker for computing the cfg post-order.
enum Visit {
Expand Down Expand Up @@ -67,7 +67,7 @@ impl PostOrder {

#[cfg(test)]
mod tests {
use crate::ssa_refactor::{
use crate::ssa::{
ir::{
function::{Function, RuntimeType},
map::Id,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use acvm::FieldElement;

use crate::ssa_refactor::ir::basic_block::BasicBlockId;
use crate::ssa::ir::basic_block::BasicBlockId;

use super::{
function::FunctionId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::collections::HashSet;

use iter_extended::vecmap;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::BasicBlockId, dfg::InsertInstructionResult, function::Function,
instruction::InstructionId,
Expand Down Expand Up @@ -94,7 +94,7 @@ impl Context {
mod test {
use std::rc::Rc;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
function::RuntimeType,
instruction::{BinaryOp, TerminatorInstruction},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use acvm::FieldElement;
use iter_extended::vecmap;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::BasicBlockId,
function::{Function, FunctionId, RuntimeType, Signature},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//! which the results are unused.
use std::collections::HashSet;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::{BasicBlock, BasicBlockId},
dfg::DataFlowGraph,
Expand Down Expand Up @@ -133,7 +133,7 @@ impl Context {

#[cfg(test)]
mod test {
use crate::ssa_refactor::{
use crate::ssa::{
ir::{function::RuntimeType, instruction::BinaryOp, map::Id, types::Type},
ssa_builder::FunctionBuilder,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ use acvm::FieldElement;
use iter_extended::vecmap;
use noirc_errors::Location;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::BasicBlockId,
cfg::ControlFlowGraph,
Expand Down Expand Up @@ -213,7 +213,7 @@ fn flatten_function_cfg(function: &mut Function) {
// TODO This loops forever, if the predecessors are not then processed
// TODO Because it will visit the same block again, pop it out of the queue
// TODO then back into the queue again.
if let crate::ssa_refactor::ir::function::RuntimeType::Brillig = function.runtime() {
if let crate::ssa::ir::function::RuntimeType::Brillig = function.runtime() {
return;
}
let cfg = ControlFlowGraph::with_function(function);
Expand Down Expand Up @@ -739,7 +739,7 @@ impl<'f> Context<'f> {
mod test {
use std::rc::Rc;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
dfg::DataFlowGraph,
function::{Function, RuntimeType},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@
//! the resulting map from each split block to each join block is returned.
use std::collections::HashMap;

use crate::ssa_refactor::ir::{
basic_block::BasicBlockId, cfg::ControlFlowGraph, function::Function,
};
use crate::ssa::ir::{basic_block::BasicBlockId, cfg::ControlFlowGraph, function::Function};

/// Returns a `HashMap` mapping blocks that start a branch (i.e. blocks terminated with jmpif) to
/// their corresponding blocks that end the branch.
Expand Down Expand Up @@ -114,7 +112,7 @@ impl<'cfg> Context<'cfg> {
#[cfg(test)]
mod test {

use crate::ssa_refactor::{
use crate::ssa::{
ir::{cfg::ControlFlowGraph, function::RuntimeType, map::Id, types::Type},
opt::flatten_cfg::branch_analysis::find_branch_ends,
ssa_builder::FunctionBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::collections::{HashMap, HashSet};

use iter_extended::vecmap;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::BasicBlockId,
dfg::InsertInstructionResult,
Expand Down Expand Up @@ -482,7 +482,7 @@ impl<'function> PerFunctionContext<'function> {
mod test {
use acvm::FieldElement;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::BasicBlockId,
function::RuntimeType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::collections::{BTreeMap, HashMap, HashSet};

use iter_extended::vecmap;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::BasicBlockId,
dfg::DataFlowGraph,
Expand Down Expand Up @@ -182,7 +182,7 @@ mod tests {
use acvm::FieldElement;
use im::vector;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::BasicBlockId,
dfg::DataFlowGraph,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//! Currently, 1 and 4 are unimplemented.
use std::collections::HashSet;

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::BasicBlockId, cfg::ControlFlowGraph, function::Function,
instruction::TerminatorInstruction,
Expand Down Expand Up @@ -148,7 +148,7 @@ fn try_inline_into_predecessor(

#[cfg(test)]
mod test {
use crate::ssa_refactor::{
use crate::ssa::{
ir::{
function::RuntimeType,
instruction::{BinaryOp, TerminatorInstruction},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//! program that will need to be removed by a later simplify cfg pass.
use std::collections::{HashMap, HashSet};

use crate::ssa_refactor::{
use crate::ssa::{
ir::{
basic_block::BasicBlockId, cfg::ControlFlowGraph, dfg::DataFlowGraph, dom::DominatorTree,
function::Function, function_inserter::FunctionInserter,
Expand Down Expand Up @@ -424,7 +424,7 @@ impl<'f> LoopIteration<'f> {

#[cfg(test)]
mod tests {
use crate::ssa_refactor::{
use crate::ssa::{
ir::{function::RuntimeType, instruction::BinaryOp, map::Id, types::Type},
ssa_builder::FunctionBuilder,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::borrow::Cow;
use acvm::FieldElement;
use noirc_errors::Location;

use crate::ssa_refactor::ir::{
use crate::ssa::ir::{
basic_block::BasicBlockId,
function::{Function, FunctionId},
instruction::{Binary, BinaryOp, Instruction, TerminatorInstruction},
Expand Down Expand Up @@ -363,7 +363,7 @@ mod tests {

use acvm::FieldElement;

use crate::ssa_refactor::ir::{
use crate::ssa::ir::{
function::RuntimeType,
instruction::{Endian, Intrinsic},
map::Id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ use noirc_frontend::monomorphization::ast::{self, LocalId, Parameters};
use noirc_frontend::monomorphization::ast::{FuncId, Program};
use noirc_frontend::{BinaryOpKind, Signedness};

use crate::ssa_refactor::ir::dfg::DataFlowGraph;
use crate::ssa_refactor::ir::function::FunctionId as IrFunctionId;
use crate::ssa_refactor::ir::function::{Function, RuntimeType};
use crate::ssa_refactor::ir::instruction::{BinaryOp, Endian, Intrinsic};
use crate::ssa_refactor::ir::map::AtomicCounter;
use crate::ssa_refactor::ir::types::{NumericType, Type};
use crate::ssa_refactor::ir::value::ValueId;
use crate::ssa_refactor::ssa_builder::FunctionBuilder;
use crate::ssa::ir::dfg::DataFlowGraph;
use crate::ssa::ir::function::FunctionId as IrFunctionId;
use crate::ssa::ir::function::{Function, RuntimeType};
use crate::ssa::ir::instruction::{BinaryOp, Endian, Intrinsic};
use crate::ssa::ir::map::AtomicCounter;
use crate::ssa::ir::types::{NumericType, Type};
use crate::ssa::ir::value::ValueId;
use crate::ssa::ssa_builder::FunctionBuilder;

use super::value::{Tree, Value, Values};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{collections::BTreeMap, fmt::Display};

use iter_extended::btree_map;

use crate::ssa_refactor::ir::{
use crate::ssa::ir::{
function::{Function, FunctionId},
map::AtomicCounter,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use iter_extended::vecmap;

use crate::ssa_refactor::ir::types::Type;
use crate::ssa_refactor::ir::value::ValueId as IrValueId;
use crate::ssa::ir::types::Type;
use crate::ssa::ir::value::ValueId as IrValueId;

use super::context::FunctionContext;

Expand Down

0 comments on commit a07b8a4

Please sign in to comment.