Add module docs and restrict visibility
This commit is contained in:
parent
59c746030a
commit
34dfbc3fef
2 changed files with 7 additions and 5 deletions
|
@ -164,7 +164,7 @@ pub struct Body<'tcx> {
|
||||||
/// FIXME(oli-obk): rewrite the promoted during promotion to eliminate the cell components.
|
/// FIXME(oli-obk): rewrite the promoted during promotion to eliminate the cell components.
|
||||||
pub ignore_interior_mut_in_const_validation: bool,
|
pub ignore_interior_mut_in_const_validation: bool,
|
||||||
|
|
||||||
pub predecessor_cache: PredecessorCache,
|
predecessor_cache: PredecessorCache,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> Body<'tcx> {
|
impl<'tcx> Body<'tcx> {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Lazily compute the reverse control-flow graph for the MIR.
|
||||||
|
|
||||||
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||||
use rustc_data_structures::sync::{Lock, Lrc};
|
use rustc_data_structures::sync::{Lock, Lrc};
|
||||||
use rustc_index::vec::IndexVec;
|
use rustc_index::vec::IndexVec;
|
||||||
|
@ -10,13 +12,13 @@ use crate::mir::{BasicBlock, BasicBlockData};
|
||||||
pub type Predecessors = IndexVec<BasicBlock, SmallVec<[BasicBlock; 4]>>;
|
pub type Predecessors = IndexVec<BasicBlock, SmallVec<[BasicBlock; 4]>>;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct PredecessorCache {
|
pub(super) struct PredecessorCache {
|
||||||
cache: Lock<Option<Lrc<Predecessors>>>,
|
cache: Lock<Option<Lrc<Predecessors>>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PredecessorCache {
|
impl PredecessorCache {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new() -> Self {
|
pub(super) fn new() -> Self {
|
||||||
PredecessorCache { cache: Lock::new(None) }
|
PredecessorCache { cache: Lock::new(None) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +29,7 @@ impl PredecessorCache {
|
||||||
/// callers of `invalidate` have a unique reference to the MIR and thus to the predecessor
|
/// callers of `invalidate` have a unique reference to the MIR and thus to the predecessor
|
||||||
/// cache. This means we don't actually need to take a lock when `invalidate` is called.
|
/// cache. This means we don't actually need to take a lock when `invalidate` is called.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn invalidate(&mut self) {
|
pub(super) fn invalidate(&mut self) {
|
||||||
*self.cache.get_mut() = None;
|
*self.cache.get_mut() = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +39,7 @@ impl PredecessorCache {
|
||||||
/// `cache` is only held inside this function. As long as no other locks are taken while
|
/// `cache` is only held inside this function. As long as no other locks are taken while
|
||||||
/// computing the predecessor graph, deadlock is impossible.
|
/// computing the predecessor graph, deadlock is impossible.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn compute(
|
pub(super) fn compute(
|
||||||
&self,
|
&self,
|
||||||
basic_blocks: &IndexVec<BasicBlock, BasicBlockData<'_>>,
|
basic_blocks: &IndexVec<BasicBlock, BasicBlockData<'_>>,
|
||||||
) -> Lrc<Predecessors> {
|
) -> Lrc<Predecessors> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue