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, WRC, rrc};
28pub use component::{Component, IdList};
29pub use context::{BackendConf, Context};
30pub use control::{
31    Cloner, Control, Empty, Enable, FSMEnable, GenericControl, If, Invoke, Par,
32    Repeat, Seq, StaticControl, StaticEnable, StaticIf, StaticInvoke,
33    StaticPar, 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, FSM, Group,
42    Port, PortIterator, PortParent, StaticGroup, Transition,
43};
44
45// Re-export types from the frontend.
46pub use calyx_frontend::{
47    Attribute, Attributes, BoolAttr, DEPRECATED_ATTRIBUTES, Direction,
48    GetAttributes, InternalAttr, LibrarySignatures, NumAttr, PortDef,
49    Primitive, PrimitiveInfo, Width, source_info,
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;