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§

pub use rewriter::Rewriter;

Modules§

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

Macros§

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

Structs§

Assignment
Represents a guarded assignment in the program
Attributes
Attributes associated with a specific IR structure.
BackendConf
Configuration information for the backends.
Builder
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
Canonical name of a Port
Cell
Represents an instantiated cell.
Cloner
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.
CombGroup
A combinational group. A combinational group does not have any holes and should only contain assignments that should will be combinationally active
Component
In memory representation of a Component.
Context
The IR Context that represents an entire Calyx program with all of its imports and dependencies resolved.
Empty
Data for the empty control statement.
Enable
Data for the enable control statement.
FSM
FSMEnable
Data for the enable control statement.
Group
A Group of assignments that perform a logical action.
GuardPool
A GuardPool is an “arena”-style storage area for FlatGuards.
GuardRef
Id
Represents an identifier in a Calyx program
IdList
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.
If
Data for the if control statement.
Invoke
Data for an invoke control statement.
LibrarySignatures
A representation of all the primitive definitions found while parsing the root program.
Nothing
Par
Data for the par control statement.
Port
Represents a port on a cell.
PortDef
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.
PortIterator
Wraps generic iterators over ports to allow functions to build and return port iterators in different ways.
Primitive
Representation of a external primitive definition.
Printer
Printer for the IR.
Repeat
Data for the Dynamic Repeat control statement. Repeats the body of the loop a given number times.
Seq
Data for the seq control statement.
StaticEnable
Data for the enable control for a static group.
StaticGroup
A Group of assignments that perform a logical action.
StaticIf
Data for the static if control statement.
StaticInvoke
Data for a StaticInvoke control statement
StaticPar
StaticRepeat
Data for the StaticRepeat control statement. Essentially a static while loop.
StaticSeq
Data for the static seq control statement.
StaticTiming
WRC
A Wrapper for a weak RefCell pointer. Used by parent pointers in the internal representation.
While
Data for the while control statement.

Enums§

Attribute
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.
BoolAttr
Attributes that are only allowed to take boolean values.
CellType
The type for a Cell
Control
Control AST nodes.
Direction
Direction of a port on a cell.
FlatGuard
GenericControl
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.
Guard
An assignment guard which has pointers to the various ports from which it reads.
InternalAttr
Internal attributes that cannot be parsed back from the IL.
NumAttr
Attributes that can take numeric values
PortComp
Comparison operations that can be performed between ports by Guard::CompOp.
PortParent
Ports can come from Cells or Groups
PrimitiveInfo
Tracks the information for Primitives defined in the program.
StaticControl
Control AST nodes.
Transition
Width
Represents an abstract width of a primitive signature.

Constants§

DEPRECATED_ATTRIBUTES
Attributes that have been deprecated.
RESERVED_NAMES
Names that are reserved in Calyx and Verilog.

Traits§

GetAttributes
Structs that can return an Attributes instance.
GetName
A trait representing something in the IR that has a name.

Functions§

rrc
Construct a new RRC.

Type Aliases§

Binding
Alias for bindings
RRC
Alias for a RefCell contained in an Rc reference.