pub struct ReachingDefinitionAnalysis {
pub reach: BTreeMap<GroupOrInvoke, DefSet>,
pub meta: MetadataMap,
}
Expand description
A struct used to compute a reaching definition analysis. The only field is a map between GroupOrInvoke labels and the definitions that exit the given group or the given Invoke node. This analysis is conservative and will only kill a definition if the group MUST write the given register and does not read it. If this is not the case old definitions will remain in the reaching set as we cannot be certain that they have been killed.
Note that this analysis assumes that groups do not appear more than once within the control structure and will provide inaccurate results if this expectation is violated.
Like super::LiveRangeAnalysis par blocks are treated via a parallel CFG approach. Concretely this means that after a par block executes any id that is killed by one arm is killed and all defs introduced (but not killed) by any arm are defined. Note that this assumes separate arms are not writing the same register or reading a registe that is written by another arm.
Fields§
§reach: BTreeMap<GroupOrInvoke, DefSet>
§meta: MetadataMap
Implementations§
Source§impl ReachingDefinitionAnalysis
impl ReachingDefinitionAnalysis
Sourcepub fn new(control: &Control) -> Self
pub fn new(control: &Control) -> Self
Constructs a reaching definition analysis for registers over the given control structure. Will include dummy “definitions” for invoke statements which can be ignored if one is not rewriting values NOTE: Assumes that each group appears at only one place in the control structure.
Sourcepub fn calculate_overlap<'a, I, T: 'a>(
&'a self,
continuous_assignments: I,
) -> BTreeMap<Id, Vec<BTreeSet<(Id, GroupOrInvoke)>>>
pub fn calculate_overlap<'a, I, T: 'a>( &'a self, continuous_assignments: I, ) -> BTreeMap<Id, Vec<BTreeSet<(Id, GroupOrInvoke)>>>
Provides a map containing a vector of sets for each register. The sets within contain separate groupings of definitions for the given register. If the vector contains one set, then all the definitions for the given register name must have the same name. NOTE: Includes dummy “definitions” for continuous assignments and uses within groups and invoke statements. This is to ensure that all uses of a given register are rewriten with the appropriate name.
Trait Implementations§
Source§impl Debug for ReachingDefinitionAnalysis
impl Debug for ReachingDefinitionAnalysis
Source§impl Default for ReachingDefinitionAnalysis
impl Default for ReachingDefinitionAnalysis
Source§fn default() -> ReachingDefinitionAnalysis
fn default() -> ReachingDefinitionAnalysis
Auto Trait Implementations§
impl Freeze for ReachingDefinitionAnalysis
impl !RefUnwindSafe for ReachingDefinitionAnalysis
impl !Send for ReachingDefinitionAnalysis
impl !Sync for ReachingDefinitionAnalysis
impl Unpin for ReachingDefinitionAnalysis
impl !UnwindSafe for ReachingDefinitionAnalysis
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more