Move dominators from Body to BasicBlocks
This commit is contained in:
@@ -5,6 +5,7 @@ use crate::mir::traversal::PostorderCache;
|
||||
use crate::mir::{BasicBlock, BasicBlockData, Successors, START_BLOCK};
|
||||
|
||||
use rustc_data_structures::graph;
|
||||
use rustc_data_structures::graph::dominators::{dominators, Dominators};
|
||||
use rustc_index::vec::IndexVec;
|
||||
|
||||
#[derive(Clone, TyEncodable, TyDecodable, Debug, HashStable, TypeFoldable, TypeVisitable)]
|
||||
@@ -34,6 +35,11 @@ impl<'tcx> BasicBlocks<'tcx> {
|
||||
self.is_cyclic.is_cyclic(self)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn dominators(&self) -> Dominators<BasicBlock> {
|
||||
dominators(&self)
|
||||
}
|
||||
|
||||
/// Returns predecessors for each basic block.
|
||||
#[inline]
|
||||
pub fn predecessors(&self) -> &Predecessors {
|
||||
|
||||
@@ -26,7 +26,7 @@ use rustc_target::abi::{Size, VariantIdx};
|
||||
use polonius_engine::Atom;
|
||||
pub use rustc_ast::Mutability;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_data_structures::graph::dominators::{dominators, Dominators};
|
||||
use rustc_data_structures::graph::dominators::Dominators;
|
||||
use rustc_index::bit_set::BitMatrix;
|
||||
use rustc_index::vec::{Idx, IndexVec};
|
||||
use rustc_serialize::{Decodable, Encodable};
|
||||
@@ -447,11 +447,6 @@ impl<'tcx> Body<'tcx> {
|
||||
.unwrap_or_else(|| Either::Right(block_data.terminator()))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn dominators(&self) -> Dominators<BasicBlock> {
|
||||
dominators(&self.basic_blocks)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn yield_ty(&self) -> Option<Ty<'tcx>> {
|
||||
self.generator.as_ref().and_then(|generator| generator.yield_ty)
|
||||
|
||||
Reference in New Issue
Block a user