calyx_ir/
lib.rs

1//! Internal representation for the [Calyx compiler](https://calyxir.org).
2//!
3//! The representation is generated from the frontend AST.
4//! The key differences between the frontend AST and the IR are:
5//! 1. The IR uses pointers instead of [`Id`] to refer to things like [`Port`] and
6//!    [`Group`].
7//! 2. The IR attempts to represent similar concepts in a homogeneous manner.
8
9// Modules defining internal structures.
10mod builder;
11mod common;
12mod component;
13mod context;
14mod control;
15mod flat_guard;
16mod guard;
17mod printer;
18mod reserved_names;
19mod structure;
20
21/// Modules to rewrite the IR
22pub mod rewriter;
23
24// Re-export types at the module level.
25pub use builder::Builder;
26pub use calyx_utils::{GetName, Id};
27pub use common::{rrc, RRC, WRC};
28pub use component::{Component, IdList};
29pub use context::{BackendConf, Context};
30pub use control::{
31    Cloner, Control, Empty, Enable, GenericControl, If, Invoke, Par, Repeat,
32    Seq, StaticControl, StaticEnable, StaticIf, StaticInvoke, StaticPar,
33    StaticRepeat, StaticSeq, While,
34};
35pub use flat_guard::{FlatGuard, GuardPool, GuardRef};
36pub use guard::{Guard, Nothing, PortComp, StaticTiming};
37pub use printer::Printer;
38pub use reserved_names::RESERVED_NAMES;
39pub use rewriter::Rewriter;
40pub use structure::{
41    Assignment, Binding, Canonical, Cell, CellType, CombGroup, Group, Port,
42    PortIterator, PortParent, StaticGroup,
43};
44
45// Re-export types from the frontend.
46pub use calyx_frontend::{
47    Attribute, Attributes, BoolAttr, Direction, GetAttributes, InternalAttr,
48    LibrarySignatures, NumAttr, PortDef, Primitive, PrimitiveInfo, Width,
49    DEPRECATED_ATTRIBUTES,
50};
51
52/// Module to transform AST programs into IR.
53pub mod from_ast;
54
55/// Convinience macros for constructing IR nodes.
56mod macros;
57
58/// Serializer methods for IR nodes.
59pub mod serializers;
60
61pub mod utils;