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
sourceimpl 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)>>>where
I: Iterator<Item = &'a Assignment<T>> + Clone + 'a,
pub fn calculate_overlap<'a, I, T: 'a>(
&'a self,
continuous_assignments: I
) -> BTreeMap<Id, Vec<BTreeSet<(Id, GroupOrInvoke)>>>where
I: Iterator<Item = &'a Assignment<T>> + Clone + 'a,
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.