Merge AnalysisDomain into Analysis.

With `GenKillAnalysis` gone, there is no need for them to be separate.
This commit is contained in:
Nicholas Nethercote
2024-10-10 11:46:29 +11:00
parent 4dc1b4d0b1
commit ba13775319
11 changed files with 62 additions and 105 deletions

View File

@@ -51,7 +51,7 @@ use tracing::debug;
use crate::fmt::DebugWithContext;
use crate::lattice::{HasBottom, HasTop};
use crate::{Analysis, AnalysisDomain, JoinSemiLattice, SwitchIntEdgeEffects};
use crate::{Analysis, JoinSemiLattice, SwitchIntEdgeEffects};
pub trait ValueAnalysis<'tcx> {
/// For each place of interest, the analysis tracks a value of the given type.
@@ -334,7 +334,7 @@ pub trait ValueAnalysis<'tcx> {
pub struct ValueAnalysisWrapper<T>(pub T);
impl<'tcx, T: ValueAnalysis<'tcx>> AnalysisDomain<'tcx> for ValueAnalysisWrapper<T> {
impl<'tcx, T: ValueAnalysis<'tcx>> Analysis<'tcx> for ValueAnalysisWrapper<T> {
type Domain = State<T::Value>;
const NAME: &'static str = T::NAME;
@@ -351,12 +351,7 @@ impl<'tcx, T: ValueAnalysis<'tcx>> AnalysisDomain<'tcx> for ValueAnalysisWrapper
state.flood(PlaceRef { local: arg, projection: &[] }, self.0.map());
}
}
}
impl<'tcx, T> Analysis<'tcx> for ValueAnalysisWrapper<T>
where
T: ValueAnalysis<'tcx>,
{
fn apply_statement_effect(
&mut self,
state: &mut Self::Domain,