From 14832b5d71912770fa0a7fc7722defa6a6ef8c2a Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Thu, 9 Feb 2023 10:53:42 +0000 Subject: [PATCH 1/3] ssa: change `get_x()` to `x()` ssa: change `get_mut_x()` to `x_mut` --- crates/noirc_evaluator/src/ssa/anchor.rs | 2 +- crates/noirc_evaluator/src/ssa/block.rs | 8 ++--- crates/noirc_evaluator/src/ssa/code_gen.rs | 12 +++---- crates/noirc_evaluator/src/ssa/conditional.rs | 32 +++++++++---------- crates/noirc_evaluator/src/ssa/context.rs | 32 +++++++++---------- crates/noirc_evaluator/src/ssa/function.rs | 10 +++--- crates/noirc_evaluator/src/ssa/inline.rs | 21 ++++++------ crates/noirc_evaluator/src/ssa/node.rs | 4 +-- .../noirc_evaluator/src/ssa/optimizations.rs | 10 +++--- 9 files changed, 65 insertions(+), 66 deletions(-) diff --git a/crates/noirc_evaluator/src/ssa/anchor.rs b/crates/noirc_evaluator/src/ssa/anchor.rs index 2658e36b0b5..3de6348fd1d 100644 --- a/crates/noirc_evaluator/src/ssa/anchor.rs +++ b/crates/noirc_evaluator/src/ssa/anchor.rs @@ -110,7 +110,7 @@ impl Anchor { ctx: &SsaContext, id: NodeId, ) -> Result<(), RuntimeError> { - let ins = ctx.get_instruction(id); + let ins = ctx.instruction(id); let (array_id, index, is_load) = Anchor::get_mem_op(&ins.operation); self.use_array(array_id, ctx.mem[array_id].len as usize); let prev_list = self.mem_list.get_mut(&array_id).unwrap(); diff --git a/crates/noirc_evaluator/src/ssa/block.rs b/crates/noirc_evaluator/src/ssa/block.rs index 2aa472802d9..1906d82b812 100644 --- a/crates/noirc_evaluator/src/ssa/block.rs +++ b/crates/noirc_evaluator/src/ssa/block.rs @@ -430,7 +430,7 @@ pub fn short_circuit_instructions( Some(target), )); let nop = instructions[0]; - debug_assert_eq!(ctx.get_instruction(nop).operation, node::Operation::Nop); + debug_assert_eq!(ctx.instruction(nop).operation, node::Operation::Nop); let mut stack = vec![nop, unreachable_ins]; //return: for &i in instructions.iter() { @@ -463,13 +463,13 @@ pub fn zero_instructions(ctx: &mut SsaContext, instructions: &[NodeId], avoid: O let mut zeros = HashMap::new(); let mut zero_keys = Vec::new(); for i in instructions { - let ins = ctx.get_instruction(*i); + let ins = ctx.instruction(*i); if ins.res_type != node::ObjectType::NotAnObject { zeros.insert(ins.res_type, ctx.zero_with_type(ins.res_type)); } else if let node::Operation::Return(ret) = &ins.operation { for i in ret { if *i != NodeId::dummy() { - let typ = ctx.get_object_type(*i); + let typ = ctx.object_type(*i); assert_ne!(typ, node::ObjectType::NotAnObject); zero_keys.push(typ); } else { @@ -488,7 +488,7 @@ pub fn zero_instructions(ctx: &mut SsaContext, instructions: &[NodeId], avoid: O } for i in instructions.iter().filter(|x| Some(*x) != avoid) { - let ins = ctx.get_mut_instruction(*i); + let ins = ctx.instruction_mut(*i); if ins.res_type != node::ObjectType::NotAnObject { ins.mark = Mark::ReplaceWith(zeros[&ins.res_type]); } else if ins.operation.opcode() != Opcode::Nop { diff --git a/crates/noirc_evaluator/src/ssa/code_gen.rs b/crates/noirc_evaluator/src/ssa/code_gen.rs index cb3186a0e91..b2a764b074e 100644 --- a/crates/noirc_evaluator/src/ssa/code_gen.rs +++ b/crates/noirc_evaluator/src/ssa/code_gen.rs @@ -270,7 +270,7 @@ impl IRGenerator { rhs: NodeId, op: UnaryOp, ) -> Result { - let rhs_type = self.context.get_object_type(rhs); + let rhs_type = self.context.object_type(rhs); match op { UnaryOp::Minus => { let lhs = self.context.zero_with_type(rhs_type); @@ -288,7 +288,7 @@ impl IRGenerator { rhs: NodeId, op: BinaryOpKind, ) -> Result { - let lhs_type = self.context.get_object_type(lhs); + let lhs_type = self.context.object_type(lhs); // Get the opcode from the infix operator let opcode = Operation::Binary(Binary::from_ast(op, lhs_type, lhs, rhs)); let op_type = self.context.get_result_type(&opcode, lhs_type); @@ -429,7 +429,7 @@ impl IRGenerator { let definition = Definition::Local(id); match value { Value::Single(node_id) => { - let object_type = self.context.get_object_type(node_id); + let object_type = self.context.object_type(node_id); let value = self.bind_variable( name.to_owned(), Some(definition.clone()), @@ -453,7 +453,7 @@ impl IRGenerator { fn bind_fresh_pattern(&mut self, basename: &str, value: Value) -> Result { match value { Value::Single(node_id) => { - let object_type = self.context.get_object_type(node_id); + let object_type = self.context.object_type(node_id); self.bind_variable(basename.to_owned(), None, object_type, node_id) } Value::Tuple(field_values) => { @@ -622,7 +622,7 @@ impl IRGenerator { Expression::Index(indexed_expr) => { // Evaluate the 'array' expression let expr_node = self.codegen_expression(&indexed_expr.collection)?.unwrap_id(); - let array = match self.context.get_object_type(expr_node) { + let array = match self.context.object_type(expr_node) { ObjectType::Pointer(array_id) => &self.context.mem[array_id], other => unreachable!("Expected Pointer type, found {:?}", other), }; @@ -827,7 +827,7 @@ impl IRGenerator { //Fixup the jump if let node::Instruction { operation: Operation::Jeq(_, target), .. } = - self.context.get_mut_instruction(jump_ins) + self.context.instruction_mut(jump_ins) { *target = block2; } diff --git a/crates/noirc_evaluator/src/ssa/conditional.rs b/crates/noirc_evaluator/src/ssa/conditional.rs index 1dcd2a43847..82784caa351 100644 --- a/crates/noirc_evaluator/src/ssa/conditional.rs +++ b/crates/noirc_evaluator/src/ssa/conditional.rs @@ -507,7 +507,7 @@ impl DecisionTree { ass_value = self[predicate].value.unwrap_or_else(NodeId::dummy); } assert!(!ctx.is_zero(ass_value), "code should have been already simplified"); - let ins1 = ctx.get_instruction(ins_id); + let ins1 = ctx.instruction(ins_id); match &ins1.operation { Operation::Call { returned_arrays, .. } => { for a in returned_arrays { @@ -529,7 +529,7 @@ impl DecisionTree { let ins = ins1.clone(); if short_circuit { stack.set_zero(ctx, ins.res_type); - let ins2 = ctx.get_mut_instruction(ins_id); + let ins2 = ctx.instruction_mut(ins_id); if ins2.res_type == ObjectType::NotAnObject { ins2.mark = Mark::Deleted; } else { @@ -540,7 +540,7 @@ impl DecisionTree { Operation::Phi { block_args, .. } => { if ctx[stack.block].kind == BlockType::IfJoin { assert_eq!(block_args.len(), 2); - let ins2 = ctx.get_mut_instruction(ins_id); + let ins2 = ctx.instruction_mut(ins_id); ins2.operation = Operation::Cond { condition: ass_cond, val_true: block_args[0].0, @@ -604,7 +604,7 @@ impl DecisionTree { return Ok(false); } if ctx.under_assumption(cond) { - let ins2 = ctx.get_mut_instruction(ins_id); + let ins2 = ctx.instruction_mut(ins_id); ins2.operation = Operation::Binary(crate::node::Binary { lhs: binary_op.lhs, rhs: binary_op.rhs, @@ -651,7 +651,7 @@ impl DecisionTree { stack.push(dummy); stack.push(cond); //store the conditional value - let ins2 = ctx.get_mut_instruction(ins_id); + let ins2 = ctx.instruction_mut(ins_id); ins2.operation = Operation::Store { array_id: *array_id, index: *index, @@ -670,7 +670,7 @@ impl DecisionTree { let name = array.name.to_string() + DUPLICATED; ctx.new_array(&name, array.element_type, array.len, None); let array_dup = ctx.mem.last_id(); - let ins2 = ctx.get_mut_instruction(ins_id); + let ins2 = ctx.instruction_mut(ins_id); ins2.res_type = ObjectType::Pointer(array_dup); let mut memcpy_stack = StackFrame::new(stack.block); @@ -699,7 +699,7 @@ impl DecisionTree { } => { if ctx.under_assumption(ass_value) { assert!(*ins_pred == AssumptionId::dummy()); - let mut ins2 = ctx.get_mut_instruction(ins_id); + let mut ins2 = ctx.instruction_mut(ins_id); ins2.operation = Operation::Call { func: *func_id, arguments: arguments.clone(), @@ -726,7 +726,7 @@ impl DecisionTree { Some(stack.block), )); stack.push(cond); - let ins2 = ctx.get_mut_instruction(ins_id); + let ins2 = ctx.instruction_mut(ins_id); ins2.operation = Operation::Constrain(cond, *loc); if ctx.is_zero(*expr) { stack.push(ins_id); @@ -760,15 +760,15 @@ impl DecisionTree { // 1. find potential matches between the two blocks let mut candidates = Vec::new(); let keep_call_and_store = |node_id: NodeId| -> bool { - let ins = ctx.get_instruction(node_id); + let ins = ctx.instruction(node_id); matches!(ins.operation.opcode(), Opcode::Call(_) | Opcode::Store(_)) }; let l_iter = left.iter().enumerate().filter(|&i| keep_call_and_store(*i.1)); let mut r_iter = right.iter().enumerate().filter(|&i| keep_call_and_store(*i.1)); for left_node in l_iter { - let left_ins = ctx.get_instruction(*left_node.1); + let left_ins = ctx.instruction(*left_node.1); for right_node in r_iter.by_ref() { - let right_ins = ctx.get_instruction(*right_node.1); + let right_ins = ctx.instruction(*right_node.1); match (&left_ins.operation, &right_ins.operation) { ( Operation::Call { func: left_func, returned_arrays: left_arrays, .. }, @@ -809,8 +809,8 @@ impl DecisionTree { result.extend_from_slice(&right[right_pos..i.right.0]); right_pos = i.right.0; //merge i: - let left_ins = ctx.get_instruction(left[left_pos]); - let right_ins = ctx.get_instruction(right[right_pos]); + let left_ins = ctx.instruction(left[left_pos]); + let right_ins = ctx.instruction(right[right_pos]); let assumption = &self[ctx[block_id].assumption]; let mut to_merge = Vec::new(); @@ -832,7 +832,7 @@ impl DecisionTree { val_true: *a.1, val_false: right_arg[a.0], }; - let typ = ctx.get_object_type(*a.1); + let typ = ctx.object_type(*a.1); to_merge.push(Instruction::new(op, typ, Some(block_id))); } Operation::Call { @@ -876,10 +876,10 @@ impl DecisionTree { if let Operation::Call { arguments, .. } = &mut merged_op { *arguments = merge_ids; } - let left_ins = ctx.get_mut_instruction(left[left_pos]); + let left_ins = ctx.instruction_mut(left[left_pos]); left_ins.mark = node::Mark::ReplaceWith(right[right_pos]); } - let ins1 = ctx.get_mut_instruction(right[right_pos]); + let ins1 = ctx.instruction_mut(right[right_pos]); ins1.operation = merged_op; result.push(ins1.id); left_pos += 1; diff --git a/crates/noirc_evaluator/src/ssa/context.rs b/crates/noirc_evaluator/src/ssa/context.rs index ff28f2d591d..710aaef9858 100644 --- a/crates/noirc_evaluator/src/ssa/context.rs +++ b/crates/noirc_evaluator/src/ssa/context.rs @@ -83,7 +83,7 @@ impl SsaContext { if id == NodeId::dummy() { return false; } - let typ = self.get_object_type(id); + let typ = self.object_type(id); if let Some(one) = self.find_const_with_type(&BigUint::one(), typ) { id == one } else { @@ -95,7 +95,7 @@ impl SsaContext { if id == NodeId::dummy() { return false; } - let typ = self.get_object_type(id); + let typ = self.object_type(id); if let Some(zero) = self.find_const_with_type(&BigUint::zero(), typ) { id == zero } else { @@ -374,7 +374,7 @@ impl SsaContext { id } - pub fn get_ssa_func(&self, func_id: FuncId) -> Option<&SSAFunction> { + pub fn ssa_func(&self, func_id: FuncId) -> Option<&SSAFunction> { self.functions.get(&func_id) } @@ -386,7 +386,7 @@ impl SsaContext { } pub fn try_get_ssa_func(&self, id: NodeId) -> Option<&SSAFunction> { - self.try_get_func_id(id).and_then(|id| self.get_ssa_func(id)) + self.try_get_func_id(id).and_then(|id| self.ssa_func(id)) } pub fn dummy_id() -> arena::Index { @@ -401,7 +401,7 @@ impl SsaContext { self.nodes.get_mut(id.0) } - pub fn get_object_type(&self, id: NodeId) -> node::ObjectType { + pub fn object_type(&self, id: NodeId) -> node::ObjectType { self[id].get_type() } @@ -413,11 +413,11 @@ impl SsaContext { None } - pub fn get_instruction(&self, id: NodeId) -> &node::Instruction { + pub fn instruction(&self, id: NodeId) -> &node::Instruction { self.try_get_instruction(id).expect("Index not found or not an instruction") } - pub fn get_mut_instruction(&mut self, id: NodeId) -> &mut node::Instruction { + pub fn instruction_mut(&mut self, id: NodeId) -> &mut node::Instruction { self.try_get_mut_instruction(id).expect("Index not found or not an instruction") } @@ -753,7 +753,7 @@ impl SsaContext { let mut fb = Some(&self[self.first_block]); while let Some(block) = fb { for iter in &block.instructions { - let ins = self.get_instruction(*iter); + let ins = self.instruction(*iter); acir.evaluate_instruction(ins, evaluator, self).map_err(RuntimeError::from)?; } //TODO we should rather follow the jumps @@ -775,7 +775,7 @@ impl SsaContext { } } - let v_type = self.get_object_type(phi_root); + let v_type = self.object_type(phi_root); let operation = Operation::Phi { root: phi_root, block_args: vec![] }; let new_phi = Instruction::new(operation, v_type, Some(target_block)); let phi_id = self.add_instruction(new_phi); @@ -823,8 +823,8 @@ impl SsaContext { index: Option, rhs: NodeId, ) -> Result { - let lhs_type = self.get_object_type(lhs); - let rhs_type = self.get_object_type(rhs); + let lhs_type = self.object_type(lhs); + let rhs_type = self.object_type(rhs); let mut ret_array = None; if let Some(Instruction { @@ -849,7 +849,7 @@ impl SsaContext { //Issue #579: we initialize the array, unless it is also in arguments in which case it is already initialized. let mut init = false; for i in arguments.clone() { - if let ObjectType::Pointer(b) = self.get_object_type(i) { + if let ObjectType::Pointer(b) = self.object_type(i) { if a == b { init = true; } @@ -979,8 +979,8 @@ impl SsaContext { stack_frame: &mut inline::StackFrame, block_id: BlockId, ) -> NodeId { - let lhs_type = self.get_object_type(lhs); - let rhs_type = self.get_object_type(rhs); + let lhs_type = self.object_type(lhs); + let rhs_type = self.object_type(rhs); if let ObjectType::Pointer(a) = lhs_type { //Array let b = stack_frame.get_or_default(a); @@ -1040,7 +1040,7 @@ impl SsaContext { let block1 = self[exit_block].predecessor[0]; let block2 = self[exit_block].predecessor[1]; - let a_type = self.get_object_type(a); + let a_type = self.object_type(a); let name = format!("if_{}_ret{c}", exit_block.0.into_raw_parts().0); *c += 1; @@ -1093,7 +1093,7 @@ impl SsaContext { } pub fn function_already_compiled(&self, func_id: FuncId) -> bool { - self.get_ssa_func(func_id).is_some() + self.ssa_func(func_id).is_some() } pub fn get_or_create_opcode_node_id(&mut self, opcode: builtin::Opcode) -> NodeId { diff --git a/crates/noirc_evaluator/src/ssa/function.rs b/crates/noirc_evaluator/src/ssa/function.rs index 5012665ce37..f97434d60c3 100644 --- a/crates/noirc_evaluator/src/ssa/function.rs +++ b/crates/noirc_evaluator/src/ssa/function.rs @@ -68,7 +68,7 @@ impl SSAFunction { let mut decision = DecisionTree::new(&ir_gen.context); let mut builder = TreeBuilder::new(self.entry_block); for (arg, _) in &self.arguments { - if let ObjectType::Pointer(a) = ir_gen.context.get_object_type(*arg) { + if let ObjectType::Pointer(a) = ir_gen.context.object_type(*arg) { builder.stack.created_arrays.insert(a, self.entry_block); } } @@ -88,7 +88,7 @@ impl SSAFunction { ); if self.entry_block != exit { for i in &stack { - ir_gen.context.get_mut_instruction(*i).parent_block = self.entry_block; + ir_gen.context.instruction_mut(*i).parent_block = self.entry_block; } } @@ -249,7 +249,7 @@ impl IRGenerator { self.context.new_instruction(call_op.clone(), ObjectType::NotAnObject)?; if let Some(id) = self.context.try_get_func_id(func) { - let callee = self.context.get_ssa_func(id).unwrap().idx; + let callee = self.context.ssa_func(id).unwrap().idx; if let Some(caller) = self.function_context { update_call_graph(&mut self.context.call_graph, caller, callee); } @@ -269,7 +269,7 @@ impl IRGenerator { *i.1, )?); } - let ssa_func = self.context.get_ssa_func(func_id).unwrap(); + let ssa_func = self.context.ssa_func(func_id).unwrap(); let func_arguments = ssa_func.arguments.clone(); for (caller_arg, func_arg) in arguments.iter().zip(func_arguments) { let mut is_array_result = false; @@ -299,7 +299,7 @@ impl IRGenerator { // Fixup the returned_arrays, they will be incorrectly tracked for higher order functions // otherwise. - self.context.get_mut_instruction(call_instruction).operation = call_op; + self.context.instruction_mut(call_instruction).operation = call_op; result_ids } diff --git a/crates/noirc_evaluator/src/ssa/inline.rs b/crates/noirc_evaluator/src/ssa/inline.rs index f25786d47e2..180cf716338 100644 --- a/crates/noirc_evaluator/src/ssa/inline.rs +++ b/crates/noirc_evaluator/src/ssa/inline.rs @@ -39,7 +39,7 @@ pub fn inline_cfg( to_inline: Option, ) -> Result { let mut result = true; - let func = ctx.get_ssa_func(func_id).unwrap(); + let func = ctx.ssa_func(func_id).unwrap(); let func_cfg = block::bfs(func.entry_block, None, ctx); let decision = func.decision.clone(); for block_id in func_cfg { @@ -78,7 +78,7 @@ fn inline_block( let mut result = true; for (ins_id, f, args, arrays, parent_block) in call_ins { if let Some(func_id) = ctx.try_get_func_id(f) { - let f_copy = ctx.get_ssa_func(func_id).unwrap().clone(); + let f_copy = ctx.ssa_func(func_id).unwrap().clone(); if !inline(ctx, &f_copy, &args, &arrays, parent_block, ins_id, decision)? { result = false; } @@ -209,8 +209,8 @@ pub fn inline( //2. by copy parameters: for (&arg_caller, &arg_function) in args.iter().zip(&func_arg) { //pass by-ref const array arguments - if let node::ObjectType::Pointer(x) = ctx.get_object_type(arg_function.0) { - if let node::ObjectType::Pointer(y) = ctx.get_object_type(arg_caller) { + if let node::ObjectType::Pointer(x) = ctx.object_type(arg_function.0) { + if let node::ObjectType::Pointer(y) = ctx.object_type(arg_caller) { if !arg_function.1 && !stack_frame.array_map.contains_key(&x) { stack_frame.array_map.insert(x, y); continue; @@ -254,12 +254,11 @@ pub fn inline_in_block( let block_func = &ctx[block_id]; let next_block = block_func.left; let block_func_instructions = &block_func.instructions.clone(); - let predicate = - if let Operation::Call { predicate, .. } = &ctx.get_instruction(call_id).operation { - *predicate - } else { - unreachable!("invalid call id"); - }; + let predicate = if let Operation::Call { predicate, .. } = &ctx.instruction(call_id).operation { + *predicate + } else { + unreachable!("invalid call id"); + }; let mut short_circuit = false; *nested_call = false; @@ -295,7 +294,7 @@ pub fn inline_in_block( result.mark = Mark::ReplaceWith(*value); } } - let call_ins = ctx.get_mut_instruction(call_id); + let call_ins = ctx.instruction_mut(call_id); call_ins.mark = Mark::Deleted; } Operation::Call { .. } => { diff --git a/crates/noirc_evaluator/src/ssa/node.rs b/crates/noirc_evaluator/src/ssa/node.rs index 2efea1a07a5..0fa2bc2451a 100644 --- a/crates/noirc_evaluator/src/ssa/node.rs +++ b/crates/noirc_evaluator/src/ssa/node.rs @@ -719,8 +719,8 @@ impl Binary { { let l_eval = eval_fn(ctx, self.lhs)?; let r_eval = eval_fn(ctx, self.rhs)?; - let l_type = ctx.get_object_type(self.lhs); - let r_type = ctx.get_object_type(self.rhs); + let l_type = ctx.object_type(self.lhs); + let r_type = ctx.object_type(self.rhs); let lhs = l_eval.into_const_value(); let rhs = r_eval.into_const_value(); diff --git a/crates/noirc_evaluator/src/ssa/optimizations.rs b/crates/noirc_evaluator/src/ssa/optimizations.rs index f002fd9337e..889c61b5db1 100644 --- a/crates/noirc_evaluator/src/ssa/optimizations.rs +++ b/crates/noirc_evaluator/src/ssa/optimizations.rs @@ -9,7 +9,7 @@ use crate::ssa::{ use acvm::FieldElement; pub fn simplify_id(ctx: &mut SsaContext, ins_id: NodeId) -> Result<(), RuntimeError> { - let mut ins = ctx.get_instruction(ins_id).clone(); + let mut ins = ctx.instruction(ins_id).clone(); simplify(ctx, &mut ins)?; ctx[ins_id] = super::node::NodeObject::Instr(ins); Ok(()) @@ -220,13 +220,13 @@ fn cse_block_with_anchor( match &operator { Operation::Binary(binary) => { - if let ObjectType::Pointer(a) = ctx.get_object_type(binary.lhs) { + if let ObjectType::Pointer(a) = ctx.object_type(binary.lhs) { //No CSE for arrays because they are not in SSA form //We could improve this in future by checking if the arrays are immutable or not modified in-between let id = ctx.get_dummy_load(a); anchor.push_mem_instruction(ctx, id)?; - if let ObjectType::Pointer(a) = ctx.get_object_type(binary.rhs) { + if let ObjectType::Pointer(a) = ctx.object_type(binary.rhs) { let id = ctx.get_dummy_load(a); anchor.push_mem_instruction(ctx, id)?; } @@ -366,7 +366,7 @@ fn cse_block_with_anchor( } } - let update = ctx.get_mut_instruction(*ins_id); + let update = ctx.instruction_mut(*ins_id); update.operation = operator; update.mark = new_mark; @@ -399,7 +399,7 @@ fn cse_block_with_anchor( )); } } - let update3 = ctx.get_mut_instruction(*ins_id); + let update3 = ctx.instruction_mut(*ins_id); *update3 = update2; } } From 2dc437bff70f9d975730532951fbbbbb02b157e6 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Fri, 10 Feb 2023 16:32:20 +0000 Subject: [PATCH 2/3] fix merge --- crates/noirc_evaluator/src/ssa/context.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/noirc_evaluator/src/ssa/context.rs b/crates/noirc_evaluator/src/ssa/context.rs index 9ef98300124..1e0625a18b0 100644 --- a/crates/noirc_evaluator/src/ssa/context.rs +++ b/crates/noirc_evaluator/src/ssa/context.rs @@ -754,7 +754,7 @@ impl SsaContext { while let Some(block) = fb { for iter in &block.instructions { let ins = self.instruction(*iter); - acir.evaluate_instruction(ins, evaluator, self).map_err(RuntimeError::from)?; + acir.acir_gen_instruction(ins, evaluator, self).map_err(RuntimeError::from)?; } //TODO we should rather follow the jumps fb = block.left.map(|block_id| &self[block_id]); From 90cff8b2647f02a916fc02adf56e33ab972f0156 Mon Sep 17 00:00:00 2001 From: Kevaundray Wedderburn Date: Sat, 11 Feb 2023 16:58:08 +0000 Subject: [PATCH 3/3] fmt -- trigger CI --- crates/noirc_evaluator/src/ssa/context.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/noirc_evaluator/src/ssa/context.rs b/crates/noirc_evaluator/src/ssa/context.rs index 1e0625a18b0..604623e12de 100644 --- a/crates/noirc_evaluator/src/ssa/context.rs +++ b/crates/noirc_evaluator/src/ssa/context.rs @@ -604,7 +604,7 @@ impl SsaContext { }) } - //Return the type of the operation result, based on the left hand type + // Return the type of the operation result, based on the left hand type pub fn get_result_type(&self, op: &Operation, lhs_type: node::ObjectType) -> node::ObjectType { use {BinaryOp::*, Operation::*}; match op { @@ -656,7 +656,7 @@ impl SsaContext { (self.add_variable(new_var, None), array_index) } - //returns the value of the element array[index], if it exists in the memory_map + // Returns the value of the element array[index], if it exists in the memory_map pub fn get_indexed_value(&self, array_id: ArrayId, index: NodeId) -> Option<&NodeId> { if let Some(idx) = Memory::to_u32(self, index) { self.mem.get_value_from_map(array_id, idx)