Struct rustc_mir_dataflow::value_analysis::State
source · pub struct State<V>(StateData<V>);
Expand description
The dataflow state for an instance of ValueAnalysis
.
Every instance specifies a lattice that represents the possible values of a single tracked
place. If we call this lattice V
and set of tracked places P
, then a State
is an
element of {unreachable} ∪ (P -> V)
. This again forms a lattice, where the bottom element is
unreachable
and the top element is the mapping p ↦ ⊤
. Note that the mapping p ↦ ⊥
is not
the bottom element (because joining an unreachable and any other reachable state yields a
reachable state). All operations on unreachable states are ignored.
Flooding means assigning a value (by default ⊤
) to all tracked projections of a given place.
Tuple Fields§
§0: StateData<V>
Implementations§
source§impl<V: Clone + HasTop + HasBottom> State<V>
impl<V: Clone + HasTop + HasBottom> State<V>
pub fn is_reachable(&self) -> bool
pub fn mark_unreachable(&mut self)
pub fn flood_all(&mut self)
pub fn flood_all_with(&mut self, value: V)
pub fn flood_with(&mut self, place: PlaceRef<'_>, map: &Map, value: V)
pub fn flood(&mut self, place: PlaceRef<'_>, map: &Map)
pub fn flood_idx_with(&mut self, place: PlaceIndex, map: &Map, value: V)
pub fn flood_idx(&mut self, place: PlaceIndex, map: &Map)
sourcepub fn assign_place_idx(
&mut self,
target: PlaceIndex,
source: PlaceIndex,
map: &Map
)
pub fn assign_place_idx(
&mut self,
target: PlaceIndex,
source: PlaceIndex,
map: &Map
)
Copies source
to target
, including all tracked places beneath.
If target
contains a place that is not contained in source
, it will be overwritten with
Top. Also, because this will copy all entries one after another, it may only be used for
places that are non-overlapping or identical.
pub fn assign(&mut self, target: PlaceRef<'_>, result: ValueOrPlace<V>, map: &Map)
pub fn assign_idx(
&mut self,
target: PlaceIndex,
result: ValueOrPlace<V>,
map: &Map
)
sourcepub fn get(&self, place: PlaceRef<'_>, map: &Map) -> V
pub fn get(&self, place: PlaceRef<'_>, map: &Map) -> V
Retrieve the value stored for a place, or ⊤ if it is not tracked.
sourcepub fn get_idx(&self, place: PlaceIndex, map: &Map) -> V
pub fn get_idx(&self, place: PlaceIndex, map: &Map) -> V
Retrieve the value stored for a place index, or ⊤ if it is not tracked.
Trait Implementations§
source§impl<'tcx, T> DebugWithContext<ValueAnalysisWrapper<T>> for State<T::Value>where
T: ValueAnalysis<'tcx>,
T::Value: Debug,
impl<'tcx, T> DebugWithContext<ValueAnalysisWrapper<T>> for State<T::Value>where
T: ValueAnalysis<'tcx>,
T::Value: Debug,
This is used to visualize the dataflow analysis.
fn fmt_with(
&self,
ctxt: &ValueAnalysisWrapper<T>,
f: &mut Formatter<'_>
) -> Result
source§fn fmt_diff_with(
&self,
old: &Self,
ctxt: &ValueAnalysisWrapper<T>,
f: &mut Formatter<'_>
) -> Result
fn fmt_diff_with(
&self,
old: &Self,
ctxt: &ValueAnalysisWrapper<T>,
f: &mut Formatter<'_>
) -> Result
source§impl<V: JoinSemiLattice + Clone> JoinSemiLattice for State<V>
impl<V: JoinSemiLattice + Clone> JoinSemiLattice for State<V>
source§impl<V: PartialEq> PartialEq<State<V>> for State<V>
impl<V: PartialEq> PartialEq<State<V>> for State<V>
impl<V: Eq> Eq for State<V>
impl<V> StructuralEq for State<V>
impl<V> StructuralPartialEq for State<V>
Auto Trait Implementations§
impl<V> RefUnwindSafe for State<V>where
V: RefUnwindSafe,
impl<V> Send for State<V>where
V: Send,
impl<V> Sync for State<V>where
V: Sync,
impl<V> Unpin for State<V>where
V: Unpin,
impl<V> UnwindSafe for State<V>where
V: UnwindSafe,
Blanket Implementations§
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 24 bytes