calyx_opt::analysis::reaching_defns

Struct ReachingDefinitionAnalysis

Source
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

Source

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.

Source

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.

Trait Implementations§

Source§

impl Debug for ReachingDefinitionAnalysis

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ReachingDefinitionAnalysis

Source§

fn default() -> ReachingDefinitionAnalysis

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.