oxilean_codegen/opt_strength/
strengthreducerule_traits.rs1use crate::lcnf::*;
12
13use super::types::StrengthReduceRule;
14use std::fmt;
15
16impl fmt::Display for StrengthReduceRule {
17 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
18 match self {
19 StrengthReduceRule::MulByPow2(n) => write!(f, "MulByPow2({})", n),
20 StrengthReduceRule::DivByPow2(n) => write!(f, "DivByPow2({})", n),
21 StrengthReduceRule::ModByPow2(n) => write!(f, "ModByPow2({})", n),
22 StrengthReduceRule::MulByConstant(c) => write!(f, "MulByConstant({})", c),
23 StrengthReduceRule::DivByConstant(c) => write!(f, "DivByConstant({})", c),
24 StrengthReduceRule::Pow2Const => write!(f, "Pow2Const"),
25 StrengthReduceRule::Pow3Const => write!(f, "Pow3Const"),
26 StrengthReduceRule::NegToSub => write!(f, "NegToSub"),
27 StrengthReduceRule::AddSubToInc => write!(f, "AddSubToInc"),
28 }
29 }
30}