Document all methods
This commit is contained in:
parent
2ce7b61995
commit
7b4dca282a
3 changed files with 15 additions and 4 deletions
|
|
@ -121,11 +121,17 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// Signals that we do not want dataflow state to propagate across unwind edges for these
|
||||
/// `BasicBlock`s.
|
||||
///
|
||||
/// You must take care that `dead_unwinds` does not contain a `BasicBlock` that *can* actually
|
||||
/// unwind during execution. Otherwise, your dataflow results will not be correct.
|
||||
pub fn dead_unwinds(mut self, dead_unwinds: &'a BitSet<BasicBlock>) -> Self {
|
||||
self.dead_unwinds = Some(dead_unwinds);
|
||||
self
|
||||
}
|
||||
|
||||
/// Computes the fixpoint for this dataflow problem and returns it.
|
||||
pub fn iterate_to_fixpoint(mut self) -> Results<'tcx, A> {
|
||||
let mut temp_state = BitSet::new_empty(self.bits_per_block);
|
||||
|
||||
|
|
|
|||
|
|
@ -60,11 +60,13 @@ impl<A> Results<'tcx, A>
|
|||
where
|
||||
A: Analysis<'tcx>,
|
||||
{
|
||||
pub fn into_cursor(self, body: &'mir mir::Body<'tcx>) -> ResultsCursor<'mir, 'tcx, A> {
|
||||
/// Creates a `ResultsCursor` that can inspect these `Results`.
|
||||
pub fn into_results_cursor(self, body: &'mir mir::Body<'tcx>) -> ResultsCursor<'mir, 'tcx, A> {
|
||||
ResultsCursor::new(body, self)
|
||||
}
|
||||
|
||||
pub fn on_block_entry(&self, block: BasicBlock) -> &BitSet<A::Idx> {
|
||||
/// Gets the entry set for the given block.
|
||||
pub fn entry_set_for_block(&self, block: BasicBlock) -> &BitSet<A::Idx> {
|
||||
&self.entry_sets[block]
|
||||
}
|
||||
}
|
||||
|
|
@ -288,12 +290,14 @@ pub trait GenKill<T> {
|
|||
/// Removes `elem` from the state vector.
|
||||
fn kill(&mut self, elem: T);
|
||||
|
||||
/// Calls `gen` for each element in `elems`.
|
||||
fn gen_all(&mut self, elems: impl IntoIterator<Item = T>) {
|
||||
for elem in elems {
|
||||
self.gen(elem);
|
||||
}
|
||||
}
|
||||
|
||||
/// Calls `kill` for each element in `elems`.
|
||||
fn kill_all(&mut self, elems: impl IntoIterator<Item = T>) {
|
||||
for elem in elems {
|
||||
self.kill(elem);
|
||||
|
|
@ -304,7 +308,7 @@ pub trait GenKill<T> {
|
|||
/// Stores a transfer function for a gen/kill problem.
|
||||
///
|
||||
/// Calling `gen`/`kill` on a `GenKillSet` will "build up" a transfer function so that it can be
|
||||
/// applied to a state vector efficiently. When there are multiple calls to `gen` and/or `kill` for
|
||||
/// applied multiple times efficiently. When there are multiple calls to `gen` and/or `kill` for
|
||||
/// the same element, the most recent one takes precedence.
|
||||
#[derive(Clone)]
|
||||
pub struct GenKillSet<T: Idx> {
|
||||
|
|
|
|||
|
|
@ -276,7 +276,8 @@ fn cursor_seek() {
|
|||
let body = &body;
|
||||
let analysis = MockAnalysis { body };
|
||||
|
||||
let mut cursor = Results { entry_sets: analysis.mock_entry_sets(), analysis }.into_cursor(body);
|
||||
let mut cursor =
|
||||
Results { entry_sets: analysis.mock_entry_sets(), analysis }.into_results_cursor(body);
|
||||
|
||||
// Sanity check: the mock call return effect is unique and actually being applied.
|
||||
let call_terminator_loc = Location { block: BasicBlock::from_usize(2), statement_index: 2 };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue