-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use DataflowResultsCursor instead of FlowAtLocation #62315
Comments
There's a few places in
trait DataflowResultsVisitorEngine<'a> {
type State: 'a;
fn reset_to_start_of_block(&'a mut self, block: BasicBlock);
fn seek(&'a mut self, loc: Location);
fn get(&'a self) -> Self::State;
}
// Tuples of `DataflowResultsCursor`s can implement `DataflowResultsVisitorEngine`
impl<'a, A, B> DataflowResultsVisitorEngine<'a> for (DataflowResultsCursor<A>, DataflowResultsCursor<B>) {
type State = (&'a BitSet<A::Idx>, &'a BitSet<B::Idx>);
/* ... */
}
// New version of `DataflowResultsConsumer`
trait DataflowResultsVisitor<'a, 'tcx> {
type Engine: DataflowResultsVisitorEngine<'a>;
// Observation Hooks: override (at least one of) these to get analysis feedback.
fn visit_block_entry(&mut self,
_bb: BasicBlock,
_flow_state: Self::Engine::State) {}
fn visit_statement_entry(&mut self,
_loc: Location,
_stmt: &Statement<'tcx>,
_flow_state: Self::Engine::State) {}
fn visit_terminator_entry(&mut self,
_loc: Location,
_term: &Terminator<'tcx>,
_flow_state: Self::Engine::State) {}
fn visit(&mut self, cursor: &'a mut Self::Engine) {
todo!()
}
}
|
Seems like this is done, right? |
Resolved by #69644. |
#61922 introduced
DataflowResultsCursor
, which provides a stateful caching interface atopFlowAtLocation
.It would be better to use
DataflowResultsCursor
from more places, both because it's a more convenient / less error-prone interface, and because it's best to have more than one code path exercising the same code. It's also awkward trying to support both interfaces at once (the cursor implementation would be cleaner if we didn't have to).The main drawback to using it is that there will be extra state/branching in places where we don't need it.
cc @eddyb who asked me to open this, and (along with @nikomatsakis) helped provide inspiration for
DataflowResultsCursor
cc @ecstatic-morse @pnkfelix
The text was updated successfully, but these errors were encountered: