Expand description
Mid-level Intermediate Representation (MIR) for Joule
MIR is the central IR where all optimizations happen, including:
- Energy optimizations
- Dead code elimination
- Constant folding
- Inlining
Key features:
- Control flow represented as basic blocks
- SSA-like representation with explicit temporaries
- All control flow is explicit (no implicit returns)
- Borrow checking happens on MIR
- Code generation targets (LLVM, Cranelift) consume MIR
Re-exports§
pub use dataflow::Channel;pub use dataflow::ChannelId;pub use dataflow::ComputeOp;pub use dataflow::DataflowGraph;pub use dataflow::DependencyAnalysis;pub use dataflow::DfOperator;pub use dataflow::EnergyEstimate;pub use dataflow::MemoryOp;pub use dataflow::OperatorId;pub use dataflow::ScheduleStep;pub use dataflow::ScheduledDfg;pub use dataflow::TokenType;pub use dataflow::TokenValue;
Modules§
- build
- HIR to MIR lowering (builder)
- const_
fold - Constant folding optimization pass for MIR.
- dataflow
- Dataflow Graph Representation for Energy-Aware Execution
- match_
lowering - Match expression lowering for Joule MIR
- ndarray_
fusion - NDArray expression fusion pass.
- pretty
- Pretty printing for MIR
- visit
- Visitor pattern for traversing MIR
Structs§
- Basic
Block - Basic block - a sequence of statements ending with a terminator
- Basic
Block Id - Unique identifier for basic blocks
- Constant
- Constant value
- Field
Idx - Field index
- Function
Attributes - Parsed function attributes for code generation decisions
- Function
Id - Unique identifier for functions
- FunctionMIR
- Complete MIR for a function
- Local
- Local variable identifier
- Local
Decl - Local variable declaration
- MirContext
- MIR context - holds all MIR for a compilation unit
- Place
- Place - an L-value (location that can be assigned to)
- Select
Arm - Select arm for select expressions
- Switch
Targets - Switch targets for conditional branches
Enums§
- Aggregate
Kind - Aggregate construction kind
- BinOp
- Binary operators
- Cast
Kind - Type of cast
- Channel
Op - Channel operation kind for select expressions
- FloatTy
- Float types
- Inline
Hint - Inline hints for the compiler
- IntTy
- Integer types
- Literal
- Literal values
- Operand
- Operand - a value used in an operation
- Place
Elem - Place projection element
- Processor
Target - Target processor for heterogeneous compilation
- Rvalue
- Rvalue - an expression that produces a value
- SimdOp
- SIMD operation kind for vectorized operations
- Simd
Width - SIMD lane width for vectorized operations
- Statement
- Statement - a side-effecting operation that doesn’t transfer control
- Terminator
- Terminator - ends a basic block and determines control flow
- Ty
- Type representation in MIR (simplified from HIR)
- UintTy
- Unsigned integer types
- UnOp
- Unary operators