pub fn compile<F: AcirField>(
acir: Circuit<F>,
expression_width: ExpressionWidth,
brillig_side_effects: &BTreeMap<BrilligFunctionId, bool>,
) -> (Circuit<F>, AcirTransformationMap)
Expand description
Applies backend specific optimizations to a Circuit
.
optimize_internal:
- General optimizer: canonalize AssertZero opcodes.
- Unused Memory: remove unused MemoryInit opcodes.
- Redundant Ranges: remove RANGE opcodes that are redundant.
transform_internal: run multiple times (up to 3) until the output stabilizes.
- CSAT: limit AssertZero opcodes to the Circuit’s width.
- Eliminate intermediate variables: Combine AssertZero opcodes used only once.
- Redundant Ranges: some RANGEs may be redundant as a side effect of the previous pass.