diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-22 14:36:44 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2023-11-23 18:49:58 +1100 |
| commit | a65e68a43bc9e71cad3c71ff826d820be7a44260 (patch) | |
| tree | 15426615d4fd8ab8f99728fbc7b1b5e82bcec5bb /compiler/rustc_mir_dataflow/src/value_analysis.rs | |
| parent | 62ffb14c3d3882efdc93c5e18e2ac843f218b725 (diff) | |
| download | rust-a65e68a43bc9e71cad3c71ff826d820be7a44260.tar.gz rust-a65e68a43bc9e71cad3c71ff826d820be7a44260.zip | |
Remove unnecessary things from `State` and `Map`.
Diffstat (limited to 'compiler/rustc_mir_dataflow/src/value_analysis.rs')
| -rw-r--r-- | compiler/rustc_mir_dataflow/src/value_analysis.rs | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/compiler/rustc_mir_dataflow/src/value_analysis.rs b/compiler/rustc_mir_dataflow/src/value_analysis.rs index addea2c9b87..9dcd5f22a2d 100644 --- a/compiler/rustc_mir_dataflow/src/value_analysis.rs +++ b/compiler/rustc_mir_dataflow/src/value_analysis.rs @@ -474,26 +474,10 @@ impl<V: Clone> State<V> { } } - pub fn is_reachable(&self) -> bool { + fn is_reachable(&self) -> bool { matches!(&self.0, StateData::Reachable(_)) } - pub fn mark_unreachable(&mut self) { - self.0 = StateData::Unreachable; - } - - pub fn flood_all(&mut self) - where - V: HasTop, - { - self.flood_all_with(V::TOP) - } - - pub fn flood_all_with(&mut self, value: V) { - let StateData::Reachable(values) = &mut self.0 else { return }; - values.raw.fill(value); - } - /// Assign `value` to all places that are contained in `place` or may alias one. pub fn flood_with(&mut self, place: PlaceRef<'_>, map: &Map, value: V) { self.flood_with_tail_elem(place, None, map, value) @@ -508,7 +492,7 @@ impl<V: Clone> State<V> { } /// Assign `value` to the discriminant of `place` and all places that may alias it. - pub fn flood_discr_with(&mut self, place: PlaceRef<'_>, map: &Map, value: V) { + fn flood_discr_with(&mut self, place: PlaceRef<'_>, map: &Map, value: V) { self.flood_with_tail_elem(place, Some(TrackElem::Discriminant), map, value) } @@ -544,7 +528,7 @@ impl<V: Clone> State<V> { /// This does nothing if the place is not tracked. /// /// The target place must have been flooded before calling this method. - pub fn insert_idx(&mut self, target: PlaceIndex, result: ValueOrPlace<V>, map: &Map) { + fn insert_idx(&mut self, target: PlaceIndex, result: ValueOrPlace<V>, map: &Map) { match result { ValueOrPlace::Value(value) => self.insert_value_idx(target, value, map), ValueOrPlace::Place(source) => self.insert_place_idx(target, source, map), @@ -908,11 +892,6 @@ impl Map { self.inner_values[root] = start..end; } - /// Returns the number of tracked places, i.e., those for which a value can be stored. - pub fn tracked_places(&self) -> usize { - self.value_count - } - /// Applies a single projection element, yielding the corresponding child. pub fn apply(&self, place: PlaceIndex, elem: TrackElem) -> Option<PlaceIndex> { self.projections.get(&(place, elem)).copied() @@ -952,7 +931,7 @@ impl Map { } /// Iterate over all direct children. - pub fn children(&self, parent: PlaceIndex) -> impl Iterator<Item = PlaceIndex> + '_ { + fn children(&self, parent: PlaceIndex) -> impl Iterator<Item = PlaceIndex> + '_ { Children::new(self, parent) } |
