Move domain_size to GenKillAnalysis.
This commit is contained in:
parent
8726cbc75f
commit
934a99eb65
8 changed files with 43 additions and 14 deletions
|
@ -165,7 +165,7 @@ where
|
|||
|
||||
// Otherwise, compute and store the cumulative transfer function for each block.
|
||||
|
||||
let identity = GenKillSet::identity(analysis.bottom_value(body).domain_size());
|
||||
let identity = GenKillSet::identity(analysis.domain_size(body));
|
||||
let mut trans_for_block = IndexVec::from_elem(identity, &body.basic_blocks);
|
||||
|
||||
for (block, block_data) in body.basic_blocks.iter_enumerated() {
|
||||
|
|
|
@ -187,10 +187,6 @@ impl<T: Idx> MeetSemiLattice for ChunkedBitSet<T> {
|
|||
pub struct Dual<T>(pub T);
|
||||
|
||||
impl<T: Idx> BitSetExt<T> for Dual<BitSet<T>> {
|
||||
fn domain_size(&self) -> usize {
|
||||
self.0.domain_size()
|
||||
}
|
||||
|
||||
fn contains(&self, elem: T) -> bool {
|
||||
self.0.contains(elem)
|
||||
}
|
||||
|
|
|
@ -54,17 +54,12 @@ pub use self::visitor::{visit_results, ResultsVisitable, ResultsVisitor};
|
|||
/// Analysis domains are all bitsets of various kinds. This trait holds
|
||||
/// operations needed by all of them.
|
||||
pub trait BitSetExt<T> {
|
||||
fn domain_size(&self) -> usize;
|
||||
fn contains(&self, elem: T) -> bool;
|
||||
fn union(&mut self, other: &HybridBitSet<T>);
|
||||
fn subtract(&mut self, other: &HybridBitSet<T>);
|
||||
}
|
||||
|
||||
impl<T: Idx> BitSetExt<T> for BitSet<T> {
|
||||
fn domain_size(&self) -> usize {
|
||||
self.domain_size()
|
||||
}
|
||||
|
||||
fn contains(&self, elem: T) -> bool {
|
||||
self.contains(elem)
|
||||
}
|
||||
|
@ -79,10 +74,6 @@ impl<T: Idx> BitSetExt<T> for BitSet<T> {
|
|||
}
|
||||
|
||||
impl<T: Idx> BitSetExt<T> for ChunkedBitSet<T> {
|
||||
fn domain_size(&self) -> usize {
|
||||
self.domain_size()
|
||||
}
|
||||
|
||||
fn contains(&self, elem: T) -> bool {
|
||||
self.contains(elem)
|
||||
}
|
||||
|
@ -295,6 +286,8 @@ where
|
|||
pub trait GenKillAnalysis<'tcx>: Analysis<'tcx> {
|
||||
type Idx: Idx;
|
||||
|
||||
fn domain_size(&self, body: &mir::Body<'tcx>) -> usize;
|
||||
|
||||
/// See `Analysis::apply_statement_effect`.
|
||||
fn statement_effect(
|
||||
&mut self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue