Crate calyx_ir

source ·
Expand description

Internal representation for the Calyx compiler.

The representation is generated from the frontend AST. The key differences between the frontend AST and the IR are:

  1. The IR uses pointers instead of Id to refer to things like Port and Group.
  2. The IR attempts to represent similar concepts in a homogeneous manner.

Re-exports§

Modules§

  • Module to transform AST programs into IR.
  • Modules to rewrite the IR
  • Serializer methods for IR nodes.
  • Helpers used to examine calyx programs. Used in Xilinx and Yxi backends among others.

Macros§

  • Build guarded assignment statements and return a vector containing them.
  • Parse guard expression into ir::Guard.
  • Add primitives and constants to the component and let-bind the references.

Structs§

  • Represents a guarded assignment in the program
  • Attributes associated with a specific IR structure.
  • Configuration information for the backends.
  • IR builder. Uses internal references to the component to construct and validate constructs when needed. By default, assumes that the cells are being added by a pass and marks them with the @generated attribute.
  • Canonical name of a Port
  • Represents an instantiated cell.
  • Implement cloning operations on control statements. We implement these separatily from the Clone trait because cloning trait is not very common and clones should be explicit.
  • A combinational group. A combinational group does not have any holes and should only contain assignments that should will be combinationally active
  • In memory representation of a Component.
  • The IR Context that represents an entire Calyx program with all of its imports and dependencies resolved.
  • Data for the empty control statement.
  • Data for the enable control statement.
  • A Group of assignments that perform a logical action.
  • A GuardPool is an “arena”-style storage area for FlatGuards.
  • Represents an identifier in a Calyx program
  • A wrapper struct exposing an ordered collection of named entities within an RRC with deterministic iteration and constant-time look-up on names directly. The struct assumes that the name of an entity cannot change. Doing so will introduce incorrect results for look-ups.
  • Data for the if control statement.
  • Data for an invoke control statement.
  • A representation of all the primitive definitions found while parsing the root program.
  • Data for the par control statement.
  • Represents a port on a cell.
  • Definition of a port parameterized by a width type. Ports on Primitives can be parameteris and use Width. Ports on Components cannot be parameterized and therefore use u64.
  • Wraps generic iterators over ports to allow functions to build and return port iterators in different ways.
  • Representation of a external primitive definition.
  • Printer for the IR.
  • Data for the Dynamic Repeat control statement. Repeats the body of the loop a given number times.
  • Data for the seq control statement.
  • Data for the enable control for a static group.
  • A Group of assignments that perform a logical action.
  • Data for the static if control statement.
  • Data for a StaticInvoke control statement
  • Data for the StaticRepeat control statement. Essentially a static while loop.
  • Data for the static seq control statement.
  • A Wrapper for a weak RefCell pointer. Used by parent pointers in the internal representation.
  • Data for the while control statement.

Enums§

  • Defines the known attributes that can be attached to IR nodes. All caps names represent attributes that are internal to the compiler and cannot be parsed back.
  • Attributes that are only allowed to take boolean values.
  • The type for a Cell
  • Control AST nodes.
  • Direction of a port on a cell.
  • Either holds a reference to a StaticControl, reference to a Control, or None Helpful when we want to be able get get any specific control statement within a control program. For example, suppose we assign an id to each enable (static or dynamic) in the control program. A function that takes in an id and returns the appropriate enable would have to return a GenericControl. Has the weird affect that GenericControl::Dynamic(Control::Static()) can be a bit redundant with GenericControl::Static() but the latter gives us more precise access to every enum in the static control, instead of just the big wrapper.
  • An assignment guard which has pointers to the various ports from which it reads.
  • Internal attributes that cannot be parsed back from the IL.
  • Attributes that can take numeric values
  • Comparison operations that can be performed between ports by Guard::CompOp.
  • Ports can come from Cells or Groups
  • Tracks the information for Primitives defined in the program.
  • Control AST nodes.
  • Represents an abstract width of a primitive signature.

Constants§

Traits§

Functions§

  • Construct a new RRC.

Type Aliases§

  • Alias for bindings
  • Alias for a RefCell contained in an Rc reference.