From a07b8a48924865d8425d35e40c75f48a13a81935 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Wed, 2 Aug 2023 20:00:23 +0100 Subject: [PATCH] chore: rename `ssa_refactor` module to `ssa` (#2129) --- .gitignore | 2 -- .../noirc_evaluator/src/brillig/brillig_gen.rs | 2 +- .../src/brillig/brillig_gen/brillig_block.rs | 9 +++++---- .../src/brillig/brillig_gen/brillig_fn.rs | 2 +- crates/noirc_evaluator/src/brillig/mod.rs | 2 +- crates/noirc_evaluator/src/lib.rs | 4 ++-- .../src/{ssa_refactor.rs => ssa.rs} | 0 .../src/{ssa_refactor => ssa}/abi_gen/mod.rs | 0 .../{ssa_refactor => ssa}/acir_gen/acir_ir.rs | 0 .../acir_gen/acir_ir/acir_variable.rs | 6 +++--- .../acir_gen/acir_ir/generated_acir.rs | 0 .../acir_gen/acir_ir/sort.rs | 0 .../src/{ssa_refactor => ssa}/acir_gen/mod.rs | 2 +- .../src/{ssa_refactor => ssa}/ir.rs | 0 .../src/{ssa_refactor => ssa}/ir/basic_block.rs | 0 .../src/{ssa_refactor => ssa}/ir/cfg.rs | 2 +- .../src/{ssa_refactor => ssa}/ir/dfg.rs | 4 ++-- .../src/{ssa_refactor => ssa}/ir/dom.rs | 2 +- .../src/{ssa_refactor => ssa}/ir/function.rs | 0 .../ir/function_inserter.rs | 0 .../src/{ssa_refactor => ssa}/ir/instruction.rs | 4 +--- .../{ssa_refactor => ssa}/ir/instruction/call.rs | 2 +- .../src/{ssa_refactor => ssa}/ir/map.rs | 0 .../src/{ssa_refactor => ssa}/ir/post_order.rs | 4 ++-- .../src/{ssa_refactor => ssa}/ir/printer.rs | 0 .../src/{ssa_refactor => ssa}/ir/types.rs | 0 .../src/{ssa_refactor => ssa}/ir/value.rs | 2 +- .../opt/constant_folding.rs | 4 ++-- .../{ssa_refactor => ssa}/opt/defunctionalize.rs | 2 +- .../src/{ssa_refactor => ssa}/opt/die.rs | 4 ++-- .../src/{ssa_refactor => ssa}/opt/flatten_cfg.rs | 6 +++--- .../opt/flatten_cfg/branch_analysis.rs | 6 ++---- .../src/{ssa_refactor => ssa}/opt/inlining.rs | 4 ++-- .../src/{ssa_refactor => ssa}/opt/mem2reg.rs | 4 ++-- .../src/{ssa_refactor => ssa}/opt/mod.rs | 0 .../{ssa_refactor => ssa}/opt/simplify_cfg.rs | 4 ++-- .../src/{ssa_refactor => ssa}/opt/unrolling.rs | 4 ++-- .../src/{ssa_refactor => ssa}/ssa_builder/mod.rs | 4 ++-- .../src/{ssa_refactor => ssa}/ssa_gen/context.rs | 16 ++++++++-------- .../src/{ssa_refactor => ssa}/ssa_gen/mod.rs | 0 .../src/{ssa_refactor => ssa}/ssa_gen/program.rs | 2 +- .../src/{ssa_refactor => ssa}/ssa_gen/value.rs | 4 ++-- 42 files changed, 54 insertions(+), 59 deletions(-) rename crates/noirc_evaluator/src/{ssa_refactor.rs => ssa.rs} (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/abi_gen/mod.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/acir_gen/acir_ir.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/acir_gen/acir_ir/acir_variable.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/acir_gen/acir_ir/generated_acir.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/acir_gen/acir_ir/sort.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/acir_gen/mod.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/basic_block.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/cfg.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/dfg.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/dom.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/function.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/function_inserter.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/instruction.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/instruction/call.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/map.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/post_order.rs (97%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/printer.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/types.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ir/value.rs (98%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/opt/constant_folding.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/opt/defunctionalize.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/opt/die.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/opt/flatten_cfg.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/opt/flatten_cfg/branch_analysis.rs (98%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/opt/inlining.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/opt/mem2reg.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/opt/mod.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/opt/simplify_cfg.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/opt/unrolling.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ssa_builder/mod.rs (99%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ssa_gen/context.rs (98%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ssa_gen/mod.rs (100%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ssa_gen/program.rs (98%) rename crates/noirc_evaluator/src/{ssa_refactor => ssa}/ssa_gen/value.rs (98%) diff --git a/.gitignore b/.gitignore index af3a8e8beb2..8aec0edeadc 100644 --- a/.gitignore +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/crates/noirc_evaluator/src/brillig/brillig_gen.rs b/crates/noirc_evaluator/src/brillig/brillig_gen.rs index 3ba04ed1afb..a1e82bbf443 100644 --- a/crates/noirc_evaluator/src/brillig/brillig_gen.rs +++ b/crates/noirc_evaluator/src/brillig/brillig_gen.rs @@ -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; diff --git a/crates/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs b/crates/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs index a9bbe189e57..ded6be71bd5 100644 --- a/crates/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs +++ b/crates/noirc_evaluator/src/brillig/brillig_gen/brillig_block.rs @@ -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}, }; diff --git a/crates/noirc_evaluator/src/brillig/brillig_gen/brillig_fn.rs b/crates/noirc_evaluator/src/brillig/brillig_gen/brillig_fn.rs index 210d6da7be6..7c4cb5e2ced 100644 --- a/crates/noirc_evaluator/src/brillig/brillig_gen/brillig_fn.rs +++ b/crates/noirc_evaluator/src/brillig/brillig_gen/brillig_fn.rs @@ -8,7 +8,7 @@ use crate::{ artifact::{BrilligParameter, Label}, BrilligContext, }, - ssa_refactor::ir::{ + ssa::ir::{ dfg::DataFlowGraph, function::{Function, FunctionId}, types::{CompositeType, Type}, diff --git a/crates/noirc_evaluator/src/brillig/mod.rs b/crates/noirc_evaluator/src/brillig/mod.rs index 105475323a7..0c6ddd53a4e 100644 --- a/crates/noirc_evaluator/src/brillig/mod.rs +++ b/crates/noirc_evaluator/src/brillig/mod.rs @@ -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, diff --git a/crates/noirc_evaluator/src/lib.rs b/crates/noirc_evaluator/src/lib.rs index c7d4f5baed6..f5403e1cf49 100644 --- a/crates/noirc_evaluator/src/lib.rs +++ b/crates/noirc_evaluator/src/lib.rs @@ -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; diff --git a/crates/noirc_evaluator/src/ssa_refactor.rs b/crates/noirc_evaluator/src/ssa.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor.rs rename to crates/noirc_evaluator/src/ssa.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/abi_gen/mod.rs b/crates/noirc_evaluator/src/ssa/abi_gen/mod.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/abi_gen/mod.rs rename to crates/noirc_evaluator/src/ssa/abi_gen/mod.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir.rs b/crates/noirc_evaluator/src/ssa/acir_gen/acir_ir.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir.rs rename to crates/noirc_evaluator/src/ssa/acir_gen/acir_ir.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/acir_variable.rs b/crates/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/acir_variable.rs rename to crates/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs index d1479ef1f1b..779aaa559ed 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/acir_variable.rs +++ b/crates/noirc_evaluator/src/ssa/acir_gen/acir_ir/acir_variable.rs @@ -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::{ diff --git a/crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs b/crates/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/generated_acir.rs rename to crates/noirc_evaluator/src/ssa/acir_gen/acir_ir/generated_acir.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/sort.rs b/crates/noirc_evaluator/src/ssa/acir_gen/acir_ir/sort.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/acir_gen/acir_ir/sort.rs rename to crates/noirc_evaluator/src/ssa/acir_gen/acir_ir/sort.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs b/crates/noirc_evaluator/src/ssa/acir_gen/mod.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs rename to crates/noirc_evaluator/src/ssa/acir_gen/mod.rs index 62a9dd5969d..331c56f59d7 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/acir_gen/mod.rs +++ b/crates/noirc_evaluator/src/ssa/acir_gen/mod.rs @@ -1086,7 +1086,7 @@ mod tests { use crate::{ brillig::Brillig, - ssa_refactor::{ + ssa::{ ir::{function::RuntimeType, map::Id, types::Type}, ssa_builder::FunctionBuilder, }, diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir.rs b/crates/noirc_evaluator/src/ssa/ir.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/ir.rs rename to crates/noirc_evaluator/src/ssa/ir.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/basic_block.rs b/crates/noirc_evaluator/src/ssa/ir/basic_block.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/ir/basic_block.rs rename to crates/noirc_evaluator/src/ssa/ir/basic_block.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/cfg.rs b/crates/noirc_evaluator/src/ssa/ir/cfg.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/ir/cfg.rs rename to crates/noirc_evaluator/src/ssa/ir/cfg.rs index f08b477696a..a91123438fa 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/cfg.rs +++ b/crates/noirc_evaluator/src/ssa/ir/cfg.rs @@ -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}; diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs b/crates/noirc_evaluator/src/ssa/ir/dfg.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs rename to crates/noirc_evaluator/src/ssa/ir/dfg.rs index 6d74e49b03b..29f5156a88c 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/dfg.rs +++ b/crates/noirc_evaluator/src/ssa/ir/dfg.rs @@ -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}, @@ -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() { diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/dom.rs b/crates/noirc_evaluator/src/ssa/ir/dom.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/ir/dom.rs rename to crates/noirc_evaluator/src/ssa/ir/dom.rs index 4763ffffbd1..b7b1728d035 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/dom.rs +++ b/crates/noirc_evaluator/src/ssa/ir/dom.rs @@ -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, diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/function.rs b/crates/noirc_evaluator/src/ssa/ir/function.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/ir/function.rs rename to crates/noirc_evaluator/src/ssa/ir/function.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/function_inserter.rs b/crates/noirc_evaluator/src/ssa/ir/function_inserter.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/ir/function_inserter.rs rename to crates/noirc_evaluator/src/ssa/ir/function_inserter.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs b/crates/noirc_evaluator/src/ssa/ir/instruction.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs rename to crates/noirc_evaluator/src/ssa/ir/instruction.rs index 7edb74f4206..680715fb0ec 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction.rs +++ b/crates/noirc_evaluator/src/ssa/ir/instruction.rs @@ -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}, }; diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction/call.rs b/crates/noirc_evaluator/src/ssa/ir/instruction/call.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/ir/instruction/call.rs rename to crates/noirc_evaluator/src/ssa/ir/instruction/call.rs index 96998d92fcf..2f0c077a1a7 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/instruction/call.rs +++ b/crates/noirc_evaluator/src/ssa/ir/instruction/call.rs @@ -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, diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/map.rs b/crates/noirc_evaluator/src/ssa/ir/map.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/ir/map.rs rename to crates/noirc_evaluator/src/ssa/ir/map.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/post_order.rs b/crates/noirc_evaluator/src/ssa/ir/post_order.rs similarity index 97% rename from crates/noirc_evaluator/src/ssa_refactor/ir/post_order.rs rename to crates/noirc_evaluator/src/ssa/ir/post_order.rs index 2f7b5edebe6..202f5cff716 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/post_order.rs +++ b/crates/noirc_evaluator/src/ssa/ir/post_order.rs @@ -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 { @@ -67,7 +67,7 @@ impl PostOrder { #[cfg(test)] mod tests { - use crate::ssa_refactor::{ + use crate::ssa::{ ir::{ function::{Function, RuntimeType}, map::Id, diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/printer.rs b/crates/noirc_evaluator/src/ssa/ir/printer.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/ir/printer.rs rename to crates/noirc_evaluator/src/ssa/ir/printer.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/types.rs b/crates/noirc_evaluator/src/ssa/ir/types.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/ir/types.rs rename to crates/noirc_evaluator/src/ssa/ir/types.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/ir/value.rs b/crates/noirc_evaluator/src/ssa/ir/value.rs similarity index 98% rename from crates/noirc_evaluator/src/ssa_refactor/ir/value.rs rename to crates/noirc_evaluator/src/ssa/ir/value.rs index cea526058b4..54831eb4a07 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ir/value.rs +++ b/crates/noirc_evaluator/src/ssa/ir/value.rs @@ -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, diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/constant_folding.rs b/crates/noirc_evaluator/src/ssa/opt/constant_folding.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/opt/constant_folding.rs rename to crates/noirc_evaluator/src/ssa/opt/constant_folding.rs index acf048595d7..ea46ddf1d4f 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/constant_folding.rs +++ b/crates/noirc_evaluator/src/ssa/opt/constant_folding.rs @@ -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, @@ -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}, diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/defunctionalize.rs b/crates/noirc_evaluator/src/ssa/opt/defunctionalize.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/opt/defunctionalize.rs rename to crates/noirc_evaluator/src/ssa/opt/defunctionalize.rs index fc3bc5d9aa6..10561bf731f 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/defunctionalize.rs +++ b/crates/noirc_evaluator/src/ssa/opt/defunctionalize.rs @@ -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}, diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/die.rs b/crates/noirc_evaluator/src/ssa/opt/die.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/opt/die.rs rename to crates/noirc_evaluator/src/ssa/opt/die.rs index ef73938cc37..935568af2db 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/die.rs +++ b/crates/noirc_evaluator/src/ssa/opt/die.rs @@ -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, @@ -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, }; diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg.rs b/crates/noirc_evaluator/src/ssa/opt/flatten_cfg.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg.rs rename to crates/noirc_evaluator/src/ssa/opt/flatten_cfg.rs index fdc4be085d7..1bcdf433d79 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg.rs +++ b/crates/noirc_evaluator/src/ssa/opt/flatten_cfg.rs @@ -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, @@ -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); @@ -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}, diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg/branch_analysis.rs b/crates/noirc_evaluator/src/ssa/opt/flatten_cfg/branch_analysis.rs similarity index 98% rename from crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg/branch_analysis.rs rename to crates/noirc_evaluator/src/ssa/opt/flatten_cfg/branch_analysis.rs index bed0686e45b..1203d03f562 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/flatten_cfg/branch_analysis.rs +++ b/crates/noirc_evaluator/src/ssa/opt/flatten_cfg/branch_analysis.rs @@ -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. @@ -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, diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/inlining.rs b/crates/noirc_evaluator/src/ssa/opt/inlining.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/opt/inlining.rs rename to crates/noirc_evaluator/src/ssa/opt/inlining.rs index 7aa2f9d176a..d4c118fd3f4 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/inlining.rs +++ b/crates/noirc_evaluator/src/ssa/opt/inlining.rs @@ -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, @@ -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, diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/mem2reg.rs b/crates/noirc_evaluator/src/ssa/opt/mem2reg.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/opt/mem2reg.rs rename to crates/noirc_evaluator/src/ssa/opt/mem2reg.rs index 15108abc490..b9e849bb77c 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/mem2reg.rs +++ b/crates/noirc_evaluator/src/ssa/opt/mem2reg.rs @@ -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, @@ -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, diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/mod.rs b/crates/noirc_evaluator/src/ssa/opt/mod.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/opt/mod.rs rename to crates/noirc_evaluator/src/ssa/opt/mod.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/simplify_cfg.rs b/crates/noirc_evaluator/src/ssa/opt/simplify_cfg.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/opt/simplify_cfg.rs rename to crates/noirc_evaluator/src/ssa/opt/simplify_cfg.rs index 22991e38b94..58259cec90c 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/simplify_cfg.rs +++ b/crates/noirc_evaluator/src/ssa/opt/simplify_cfg.rs @@ -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, @@ -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}, diff --git a/crates/noirc_evaluator/src/ssa_refactor/opt/unrolling.rs b/crates/noirc_evaluator/src/ssa/opt/unrolling.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/opt/unrolling.rs rename to crates/noirc_evaluator/src/ssa/opt/unrolling.rs index e5d7d6f0d5c..f6d7c952277 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/opt/unrolling.rs +++ b/crates/noirc_evaluator/src/ssa/opt/unrolling.rs @@ -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, @@ -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, }; diff --git a/crates/noirc_evaluator/src/ssa_refactor/ssa_builder/mod.rs b/crates/noirc_evaluator/src/ssa/ssa_builder/mod.rs similarity index 99% rename from crates/noirc_evaluator/src/ssa_refactor/ssa_builder/mod.rs rename to crates/noirc_evaluator/src/ssa/ssa_builder/mod.rs index 02350d9ed17..066b5b51199 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ssa_builder/mod.rs +++ b/crates/noirc_evaluator/src/ssa/ssa_builder/mod.rs @@ -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}, @@ -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, diff --git a/crates/noirc_evaluator/src/ssa_refactor/ssa_gen/context.rs b/crates/noirc_evaluator/src/ssa/ssa_gen/context.rs similarity index 98% rename from crates/noirc_evaluator/src/ssa_refactor/ssa_gen/context.rs rename to crates/noirc_evaluator/src/ssa/ssa_gen/context.rs index a526d93f85b..3e0bbff2a83 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ssa_gen/context.rs +++ b/crates/noirc_evaluator/src/ssa/ssa_gen/context.rs @@ -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}; diff --git a/crates/noirc_evaluator/src/ssa_refactor/ssa_gen/mod.rs b/crates/noirc_evaluator/src/ssa/ssa_gen/mod.rs similarity index 100% rename from crates/noirc_evaluator/src/ssa_refactor/ssa_gen/mod.rs rename to crates/noirc_evaluator/src/ssa/ssa_gen/mod.rs diff --git a/crates/noirc_evaluator/src/ssa_refactor/ssa_gen/program.rs b/crates/noirc_evaluator/src/ssa/ssa_gen/program.rs similarity index 98% rename from crates/noirc_evaluator/src/ssa_refactor/ssa_gen/program.rs rename to crates/noirc_evaluator/src/ssa/ssa_gen/program.rs index aec0e4262c8..509f778f3b0 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ssa_gen/program.rs +++ b/crates/noirc_evaluator/src/ssa/ssa_gen/program.rs @@ -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, }; diff --git a/crates/noirc_evaluator/src/ssa_refactor/ssa_gen/value.rs b/crates/noirc_evaluator/src/ssa/ssa_gen/value.rs similarity index 98% rename from crates/noirc_evaluator/src/ssa_refactor/ssa_gen/value.rs rename to crates/noirc_evaluator/src/ssa/ssa_gen/value.rs index 2d209635610..e7bb515465b 100644 --- a/crates/noirc_evaluator/src/ssa_refactor/ssa_gen/value.rs +++ b/crates/noirc_evaluator/src/ssa/ssa_gen/value.rs @@ -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;