pub trait Visitor {
Show 34 methods fn precondition(_ctx: &Context) -> Option<String>
    where
        Self: Sized
, { ... } fn start_context(&mut self, _ctx: &mut Context) -> VisResult { ... } fn finish_context(&mut self, _ctx: &mut Context) -> VisResult { ... } fn iteration_order() -> Order
    where
        Self: Sized
, { ... } fn traverse_component(
        &mut self,
        comp: &mut Component,
        signatures: &LibrarySignatures,
        components: &[Component]
    ) -> CalyxResult<()>
    where
        Self: Sized
, { ... } fn do_pass(&mut self, context: &mut Context) -> CalyxResult<()>
    where
        Self: Sized + ConstructVisitor + Named
, { ... } fn do_pass_default(context: &mut Context) -> CalyxResult<Self>
    where
        Self: ConstructVisitor + Sized + Named
, { ... } fn start(
        &mut self,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish(
        &mut self,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn start_seq(
        &mut self,
        _s: &mut Seq,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish_seq(
        &mut self,
        _s: &mut Seq,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn start_par(
        &mut self,
        _s: &mut Par,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish_par(
        &mut self,
        _s: &mut Par,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn start_if(
        &mut self,
        _s: &mut If,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish_if(
        &mut self,
        _s: &mut If,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn start_while(
        &mut self,
        _s: &mut While,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish_while(
        &mut self,
        _s: &mut While,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn start_repeat(
        &mut self,
        _s: &mut Repeat,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish_repeat(
        &mut self,
        _s: &mut Repeat,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn start_static_control(
        &mut self,
        _s: &mut StaticControl,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish_static_control(
        &mut self,
        _s: &mut StaticControl,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn enable(
        &mut self,
        _s: &mut Enable,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn static_enable(
        &mut self,
        _s: &mut StaticEnable,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn start_static_if(
        &mut self,
        _s: &mut StaticIf,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish_static_if(
        &mut self,
        _s: &mut StaticIf,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn start_static_repeat(
        &mut self,
        _s: &mut StaticRepeat,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish_static_repeat(
        &mut self,
        _s: &mut StaticRepeat,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn start_static_seq(
        &mut self,
        _s: &mut StaticSeq,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish_static_seq(
        &mut self,
        _s: &mut StaticSeq,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn start_static_par(
        &mut self,
        _s: &mut StaticPar,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn finish_static_par(
        &mut self,
        _s: &mut StaticPar,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn invoke(
        &mut self,
        _s: &mut Invoke,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn static_invoke(
        &mut self,
        _s: &mut StaticInvoke,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... } fn empty(
        &mut self,
        _s: &mut Empty,
        _comp: &mut Component,
        _sigs: &LibrarySignatures,
        _comps: &[Component]
    ) -> VisResult { ... }
}
Expand description

The visiting interface for a ir::Control program. Contains two kinds of functions:

  1. start_: Called when visiting top-down.
  2. finish_: Called when visiting bottow-up.

A pass will usually override one or more function and rely on the default visitors to automatically visit the children.

Provided Methods

Precondition for this pass to run on the program. If this function returns None, the pass triggers. Otherwise it aborts and logs the string as the reason.

Transform the ir::Context before visiting the components.

Transform the ir::Context after visiting the components.

Define the iteration order in which components should be visited

Define the traversal over a component. Calls Visitor::start, visits each control node, and finally calls Visitor::finish.

Run the visitor on a given program ir::Context. The function mutably borrows the control program in each component and traverses it.

After visiting a component, it called ConstructVisitor::clear_data to reset the struct.

Panics

Panics if the pass attempts to use the control program mutably.

Build a Default implementation of this pass and call Visitor::do_pass using it.

Executed before the traversal begins.

Executed after the traversal ends. This method is always invoked regardless of the Action returned from the children.

Executed before visiting the children of a ir::Seq node.

Executed after visiting the children of a ir::Seq node.

Executed before visiting the children of a ir::Par node.

Executed after visiting the children of a ir::Par node.

Executed before visiting the children of a ir::If node.

Executed after visiting the children of a ir::If node.

Executed before visiting the children of a ir::While node.

Executed after visiting the children of a ir::While node.

Executed before visiting the children of a ir::Repeat node.

Executed after visiting the children of a ir::Repeat node.

Executed before visiting the contents of an ir::StaticControl node.

Executed after visiting the conetnts of an ir::StaticControl node.

Executed at an ir::Enable node.

Executed at an ir::StaticEnable node.

Executed before visiting the children of a ir::StaticIf node.

Executed after visiting the children of a ir::StaticIf node.

Executed before visiting the children of a ir::StaticRepeat node.

Executed after visiting the children of a ir::StaticRepeat node.

Executed at an ir::Invoke node.

Executed at a ir::StaticInvoke node.

Executed at an ir::Empty node.

Implementors

The algorithm that runs is:

  • instantiate conflict graph using all component cells that satisfy cell_filter
  • use [ScheduleConflicts] to find groups/invokes that run in parallel with each other
  • for each tuple combination of cells that return true on cell_filter(), c1 and c2
  • first determine if their live ranges overlap. If so, then insert a conflict between c1 and c2
  • if c1 and c2 don’t have overlapping live ranges, check if c1 and c2 are ever live at within the same par block, and they are live at different children of the par block. If the parent par is not static, then add a conflict. If the parent par is static, then we can use the static_par_timing analysis to check whether the cells’ liveness actually overlaps.
  • perform graph coloring using self.ordering to define the order of the greedy coloring
  • use coloring to rewrite group assignments, continuous assignments, and conditional ports.