diff --git a/autoprecompiles/src/lib.rs b/autoprecompiles/src/lib.rs index d6c1ea2ba..7bf271d35 100644 --- a/autoprecompiles/src/lib.rs +++ b/autoprecompiles/src/lib.rs @@ -3,7 +3,7 @@ use crate::blocks::BasicBlock; use crate::bus_map::{BusMap, BusType}; use crate::evaluation::AirStats; use crate::expression_conversion::algebraic_to_grouped_expression; -use crate::symbolic_machine_generator::convert_machine; +use crate::symbolic_machine_generator::convert_machine_field_type; use expression::{AlgebraicExpression, AlgebraicReference}; use itertools::Itertools; use powdr::UniqueReferences; @@ -382,7 +382,7 @@ pub fn build( metrics::counter!("after_opt_interactions", &labels) .absolute(machine.unique_references().count() as u64); - let machine = convert_machine(machine, &A::into_field); + let machine = convert_machine_field_type(machine, &A::into_field); let apc = Apc { block, diff --git a/autoprecompiles/src/symbolic_machine_generator.rs b/autoprecompiles/src/symbolic_machine_generator.rs index cbc6decf0..c60a429d8 100644 --- a/autoprecompiles/src/symbolic_machine_generator.rs +++ b/autoprecompiles/src/symbolic_machine_generator.rs @@ -10,20 +10,21 @@ use crate::{ SymbolicMachine, }; -pub fn convert_machine( +/// Converts the field type of a symbolic machine. +pub fn convert_machine_field_type( machine: SymbolicMachine, - convert: &impl Fn(T) -> U, + convert_field_element: &impl Fn(T) -> U, ) -> SymbolicMachine { SymbolicMachine { constraints: machine .constraints .into_iter() - .map(|c| convert_symbolic_constraint(c, convert)) + .map(|c| convert_symbolic_constraint(c, convert_field_element)) .collect(), bus_interactions: machine .bus_interactions .into_iter() - .map(|i| convert_bus_interaction(i, convert)) + .map(|i| convert_bus_interaction(i, convert_field_element)) .collect(), } } @@ -81,6 +82,10 @@ fn convert_expression( } } +/// Converts a basic block into a symbolic machine and a vector +/// that contains, for each instruction in the basic block, +/// a mapping from local column IDs to global column IDs +/// (in the form of a vector). pub fn statements_to_symbolic_machine( block: &BasicBlock, instruction_handler: &A::InstructionHandler, @@ -98,7 +103,7 @@ pub fn statements_to_symbolic_machine( .clone(); let machine: SymbolicMachine<::PowdrField> = - convert_machine(machine, &|x| A::from_field(x)); + convert_machine_field_type(machine, &|x| A::from_field(x)); // It is sufficient to provide the initial PC, because the PC update should be // deterministic within a basic block. Therefore, all future PCs can be derived