midenc_hir_analysis/sparse/lattice.rs
1use crate::{AnalysisState, ChangeResult};
2
3/// A [SparseLattice] represents some analysis state attached to a specific value.
4///
5/// It is propagated through the IR by sparse data-flow analysis.
6#[allow(unused_variables)]
7pub trait SparseLattice: AnalysisState + core::fmt::Debug {
8 type Lattice;
9
10 /// Get the underlying lattice value
11 fn lattice(&self) -> &Self::Lattice;
12
13 /// Join `rhs` with `self`, returning whether or not a change was made
14 fn join(&mut self, rhs: &Self::Lattice) -> ChangeResult {
15 ChangeResult::Unchanged
16 }
17
18 /// Meet `rhs` with `self`, returning whether or not a change was made
19 fn meet(&mut self, rhs: &Self::Lattice) -> ChangeResult {
20 ChangeResult::Unchanged
21 }
22}