mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-16 17:03:35 +00:00
Move switch_sources
from Body to BasicBlocks
This commit is contained in:
parent
39d9c1cb1f
commit
dfa6a7cbde
@ -42,7 +42,6 @@ use std::ops::{ControlFlow, Index, IndexMut};
|
|||||||
use std::{iter, mem};
|
use std::{iter, mem};
|
||||||
|
|
||||||
pub use self::query::*;
|
pub use self::query::*;
|
||||||
use self::switch_sources::SwitchSources;
|
|
||||||
pub use basic_blocks::BasicBlocks;
|
pub use basic_blocks::BasicBlocks;
|
||||||
|
|
||||||
mod basic_blocks;
|
mod basic_blocks;
|
||||||
@ -448,13 +447,6 @@ impl<'tcx> Body<'tcx> {
|
|||||||
.unwrap_or_else(|| Either::Right(block_data.terminator()))
|
.unwrap_or_else(|| Either::Right(block_data.terminator()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `body.switch_sources()[&(target, switch)]` returns a list of switch
|
|
||||||
/// values that lead to a `target` block from a `switch` block.
|
|
||||||
#[inline]
|
|
||||||
pub fn switch_sources(&self) -> &SwitchSources {
|
|
||||||
self.basic_blocks.switch_sources()
|
|
||||||
}
|
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn dominators(&self) -> Dominators<BasicBlock> {
|
pub fn dominators(&self) -> Dominators<BasicBlock> {
|
||||||
dominators(&self.basic_blocks)
|
dominators(&self.basic_blocks)
|
||||||
|
@ -316,7 +316,7 @@ where
|
|||||||
fn apply(&mut self, mut apply_edge_effect: impl FnMut(&mut D, SwitchIntTarget)) {
|
fn apply(&mut self, mut apply_edge_effect: impl FnMut(&mut D, SwitchIntTarget)) {
|
||||||
assert!(!self.effects_applied);
|
assert!(!self.effects_applied);
|
||||||
|
|
||||||
let values = &self.body.switch_sources()[&(self.bb, self.pred)];
|
let values = &self.body.basic_blocks.switch_sources()[&(self.bb, self.pred)];
|
||||||
let targets = values.iter().map(|&value| SwitchIntTarget { value, target: self.bb });
|
let targets = values.iter().map(|&value| SwitchIntTarget { value, target: self.bb });
|
||||||
|
|
||||||
let mut tmp = None;
|
let mut tmp = None;
|
||||||
|
Loading…
Reference in New Issue
Block a user