Expand description
Stack scheduling for EVM code generation.
This module handles the translation from MIR’s SSA values to EVM’s stack-based model.
The key abstraction is StackModel, which tracks which MIR values are at which stack depths.
§Submodules
model: Core stack model tracking value positionsscheduler: Stack scheduler for generating DUP/SWAP sequencesshuffler: Optimal stack layout transitions (backward analysis)spill: Spill management for values beyond depth 16
Modules§
- shuffler
- Stack shuffler for optimal stack layout transitions.
Structs§
- Block
Stack Layout - Represents a stack layout for a block - the values that should be on the stack when entering or exiting a block, from top to bottom.
- Layout
Analysis - Computes the ideal entry layout for an instruction given the desired exit layout.
- Shuffle
Result - Result of a shuffle operation.
- Spill
Manager - Manages spill slots for values that cannot fit on the stack.
- Spill
Slot - A slot in memory where a spilled value is stored.
- Stack
Model - Represents the current state of the EVM stack.
- Stack
Scheduler - Stack scheduler that generates stack manipulation operations.
- Stack
Shuffler - The stack shuffler transforms a source stack layout to a target layout.
Enums§
- Scheduled
Op - A scheduled operation to emit.
- StackOp
- Operations to emit for stack manipulation.
- Target
Slot - Represents a slot in the target layout.
Functions§
- combine_
stack_ layouts - Computes a common stack layout for multiple incoming edges at a merge point.
- estimate_
shuffle_ cost - Computes the shuffle cost from a source layout to a target layout. This estimates the number of DUP/SWAP/POP operations needed.
- ideal_
binary_ op_ entry - Computes the ideal pre-layout for a binary operation.
- ideal_
operand_ layout - Creates an ideal layout for preparing multiple operands.
- ideal_
unary_ op_ entry - Computes the ideal pre-layout for a unary operation.
- is_
freely_ generable - Checks if a value can be freely generated (doesn’t need to be on stack).