Skip to content

Commit

Permalink
Remove unused arguments from ResultsVisitor::visit_block_{start,end}.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Dec 7, 2023
1 parent 7a34091 commit f312775
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 34 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_mir_dataflow/src/framework/direction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ impl Direction for Backward {
{
results.reset_to_block_entry(state, block);

vis.visit_block_end(results, state, block_data, block);
vis.visit_block_end(state);

// Terminator
let loc = Location { block, statement_index: block_data.statements.len() };
Expand All @@ -214,7 +214,7 @@ impl Direction for Backward {
vis.visit_statement_after_primary_effect(results, state, stmt, loc);
}

vis.visit_block_start(results, state, block_data, block);
vis.visit_block_start(state);
}

fn join_state_into_successors_of<'tcx, A>(
Expand Down Expand Up @@ -449,7 +449,7 @@ impl Direction for Forward {
{
results.reset_to_block_entry(state, block);

vis.visit_block_start(results, state, block_data, block);
vis.visit_block_start(state);

for (statement_index, stmt) in block_data.statements.iter().enumerate() {
let loc = Location { block, statement_index };
Expand All @@ -466,7 +466,7 @@ impl Direction for Forward {
results.reconstruct_terminator_effect(state, term, loc);
vis.visit_terminator_after_primary_effect(results, state, term, loc);

vis.visit_block_end(results, state, block_data, block);
vis.visit_block_end(state);
}

fn join_state_into_successors_of<'tcx, A>(
Expand Down
16 changes: 2 additions & 14 deletions compiler/rustc_mir_dataflow/src/framework/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,25 +545,13 @@ where
{
type FlowState = A::Domain;

fn visit_block_start(
&mut self,
_results: &mut Results<'tcx, A>,
state: &Self::FlowState,
_block_data: &mir::BasicBlockData<'tcx>,
_block: BasicBlock,
) {
fn visit_block_start(&mut self, state: &Self::FlowState) {
if A::Direction::IS_FORWARD {
self.prev_state.clone_from(state);
}
}

fn visit_block_end(
&mut self,
_results: &mut Results<'tcx, A>,
state: &Self::FlowState,
_block_data: &mir::BasicBlockData<'tcx>,
_block: BasicBlock,
) {
fn visit_block_end(&mut self, state: &Self::FlowState) {
if A::Direction::IS_BACKWARD {
self.prev_state.clone_from(state);
}
Expand Down
18 changes: 2 additions & 16 deletions compiler/rustc_mir_dataflow/src/framework/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,7 @@ pub fn visit_results<'mir, 'tcx, F, R>(
pub trait ResultsVisitor<'mir, 'tcx, R> {
type FlowState;

fn visit_block_start(
&mut self,
_results: &mut R,
_state: &Self::FlowState,
_block_data: &'mir mir::BasicBlockData<'tcx>,
_block: BasicBlock,
) {
}
fn visit_block_start(&mut self, _state: &Self::FlowState) {}

/// Called with the `before_statement_effect` of the given statement applied to `state` but not
/// its `statement_effect`.
Expand Down Expand Up @@ -86,14 +79,7 @@ pub trait ResultsVisitor<'mir, 'tcx, R> {
) {
}

fn visit_block_end(
&mut self,
_results: &mut R,
_state: &Self::FlowState,
_block_data: &'mir mir::BasicBlockData<'tcx>,
_block: BasicBlock,
) {
}
fn visit_block_end(&mut self, _state: &Self::FlowState) {}
}

/// Things that can be visited by a `ResultsVisitor`.
Expand Down

0 comments on commit f312775

Please sign in to comment.