Skip to main content

oxilean_codegen/opt_passes/
copypropagationpass_traits.rs

1//! # CopyPropagationPass - Trait Implementations
2//!
3//! This module contains trait implementations for `CopyPropagationPass`.
4//!
5//! ## Implemented Traits
6//!
7//! - `Default`
8//! - `Debug`
9//! - `OptPass`
10//!
11//! 🤖 Generated with [SplitRS](https://github.com/cool-japan/splitrs)
12
13use crate::lcnf::{LcnfArg, LcnfExpr, LcnfFunDecl, LcnfLetValue, LcnfLit, LcnfVarId};
14
15use super::functions::OptPass;
16use super::types::CopyPropagationPass;
17use std::fmt;
18
19impl Default for CopyPropagationPass {
20    fn default() -> Self {
21        Self::new()
22    }
23}
24
25impl fmt::Debug for CopyPropagationPass {
26    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27        write!(f, "CopyPropagationPass(subs={})", self.substitutions)
28    }
29}
30
31impl OptPass for CopyPropagationPass {
32    fn name(&self) -> &str {
33        "copy_propagation"
34    }
35    fn run_pass(&mut self, decls: &mut [LcnfFunDecl]) -> usize {
36        let before = self.substitutions;
37        self.run(decls);
38        (self.substitutions - before) as usize
39    }
40}