Crate joule_mir

Crate joule_mir 

Source
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§

BasicBlock
Basic block - a sequence of statements ending with a terminator
BasicBlockId
Unique identifier for basic blocks
Constant
Constant value
FieldIdx
Field index
FunctionAttributes
Parsed function attributes for code generation decisions
FunctionId
Unique identifier for functions
FunctionMIR
Complete MIR for a function
Local
Local variable identifier
LocalDecl
Local variable declaration
MirContext
MIR context - holds all MIR for a compilation unit
Place
Place - an L-value (location that can be assigned to)
SelectArm
Select arm for select expressions
SwitchTargets
Switch targets for conditional branches

Enums§

AggregateKind
Aggregate construction kind
BinOp
Binary operators
CastKind
Type of cast
ChannelOp
Channel operation kind for select expressions
FloatTy
Float types
InlineHint
Inline hints for the compiler
IntTy
Integer types
Literal
Literal values
Operand
Operand - a value used in an operation
PlaceElem
Place projection element
ProcessorTarget
Target processor for heterogeneous compilation
Rvalue
Rvalue - an expression that produces a value
SimdOp
SIMD operation kind for vectorized operations
SimdWidth
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