1+ //! Lazily compute the reverse control-flow graph for the MIR.
2+
13use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
24use rustc_data_structures:: sync:: { Lock , Lrc } ;
35use rustc_index:: vec:: IndexVec ;
@@ -10,13 +12,13 @@ use crate::mir::{BasicBlock, BasicBlockData};
1012pub type Predecessors = IndexVec < BasicBlock , SmallVec < [ BasicBlock ; 4 ] > > ;
1113
1214#[ derive( Clone , Debug ) ]
13- pub struct PredecessorCache {
15+ pub ( super ) struct PredecessorCache {
1416 cache : Lock < Option < Lrc < Predecessors > > > ,
1517}
1618
1719impl PredecessorCache {
1820 #[ inline]
19- pub fn new ( ) -> Self {
21+ pub ( super ) fn new ( ) -> Self {
2022 PredecessorCache { cache : Lock :: new ( None ) }
2123 }
2224
@@ -27,7 +29,7 @@ impl PredecessorCache {
2729 /// callers of `invalidate` have a unique reference to the MIR and thus to the predecessor
2830 /// cache. This means we don't actually need to take a lock when `invalidate` is called.
2931 #[ inline]
30- pub fn invalidate ( & mut self ) {
32+ pub ( super ) fn invalidate ( & mut self ) {
3133 * self . cache . get_mut ( ) = None ;
3234 }
3335
@@ -37,7 +39,7 @@ impl PredecessorCache {
3739 /// `cache` is only held inside this function. As long as no other locks are taken while
3840 /// computing the predecessor graph, deadlock is impossible.
3941 #[ inline]
40- pub fn compute (
42+ pub ( super ) fn compute (
4143 & self ,
4244 basic_blocks : & IndexVec < BasicBlock , BasicBlockData < ' _ > > ,
4345 ) -> Lrc < Predecessors > {
0 commit comments