Expand description
§solar-codegen
Solidity MIR (Mid-level Intermediate Representation) and EVM code generation for Solar.
§Architecture
HIR (from solar-sema) -> Lowering -> MIR -> Code Generation -> EVM Bytecode§MIR Structure
- Module: Top-level container with functions, data segments, and storage layout
- Function: SSA-form functions with basic blocks, values, and instructions
- BasicBlock: Sequence of instructions ending with a terminator
- Instruction: Operations (arithmetic, memory, storage, control flow)
- Value: SSA values (instruction results, arguments, immediates, phi nodes)
§Key Types
ValueId,InstId,BlockId,FunctionId: Index types for SSA valuesMirType: Types used in MIR (UInt, Address, MemPtr, StoragePtr)InstKind: Instruction variants (Add, Sub, SLoad, SStore, Call, etc.)Terminator: Block terminators (Jump, Branch, Return, Revert)
Modules§
- analysis
- MIR analysis passes.
- backend
- The backend protocol.
- lower
- HIR to MIR lowering.
- mir
- Mid-level Intermediate Representation (MIR).
- pass
- Pass infrastructure for MIR transformations and analyses.
- sema
- solar-sema
- transform
- Optimization and transformation passes for the Solar compiler.
Structs§
- Assembled
Code - Result of assembly.
- Assembler
- Two-pass assembler for EVM bytecode.
- Assembler
Config - Configuration for EVM bytecode assembly.
- Basic
Block - A basic block in the MIR.
- BlockId
- A unique identifier for a basic block in the MIR.
- Common
Subexpr Eliminator - Common Subexpression Elimination pass.
- DceStats
- Statistics for a DCE run.
- Dead
Code Eliminator - Dead Code Elimination pass.
- EvmArtifact
- The artifact produced by the EVM backend: deployment and runtime bytecode.
- EvmCodegen
- EVM code generator.
- EvmCodegen
Config - Configuration for the EVM backend.
- EvmIr
Block - A basic block in EVM IR.
- EvmIr
Block Id - A unique identifier for a basic block in EVM IR.
- EvmIr
Block Metadata - Block-level metadata.
- EvmIr
Instruction - A non-terminating untyped backend instruction.
- EvmIr
Metadata - Generic metadata carried by instructions and terminators.
- EvmIr
Metadata Item - A metadata key-value item.
- EvmIr
Module - An EVM IR module.
- EvmIr
Parse Error - An error produced while parsing the EVM IR text format.
- EvmIr
Stack Effect - Stack effect metadata for one EVM IR operation.
- EvmIr
Terminator - A control-flow terminator.
- EvmIr
Value - A named untyped stack word.
- EvmIr
Value Id - A unique identifier for an untyped stack word in EVM IR.
- Function
- A function in the MIR.
- Function
Id - A unique identifier for a function in the MIR.
- Function
Inline Info - Analysis result for a function’s inlineability.
- Induction
Variable - An induction variable in a loop.
- Inline
Analyzer - Analyzes functions for inlining opportunities.
- Inline
Config - Configuration for function inlining.
- Inline
Stats - Statistics about inlining performed.
- InstId
- A unique identifier for an instruction in the MIR.
- Inst
Simplifier - Local MIR instruction simplification pass.
- Instruction
- An instruction in the MIR.
- Jump
Threader - Jump threading optimization pass.
- Jump
Threading Stats - Statistics from jump threading optimization.
- Label
- A label identifier.
- Liveness
- Liveness analysis results for a function.
- Liveness
Info - Per-instruction liveness information.
- Loop
- A natural loop in the control flow graph.
- Loop
Analyzer - Loop analyzer that detects and analyzes loops in MIR functions.
- Loop
Info - Result of loop analysis for a function.
- Loop
OptConfig - Loop optimization pass configuration.
- Loop
OptStats - Statistics from loop optimization.
- Loop
Optimizer - Loop optimizer.
- Lowerer
- Lowering context for converting HIR to MIR.
- Module
- A MIR module representing a compiled contract.
- 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.
- ValueId
- A unique identifier for a value in the MIR.
Enums§
- EvmIr
Block Hotness - Block hotness metadata.
- EvmIr
Operand - An instruction or terminator operand.
- EvmIr
Terminator Kind - Control-flow terminators in EVM IR.
- Immediate
- An immediate constant value.
- Inline
Decision - Inlining decision for a function.
- Inst
Kind - The kind of an instruction.
- MirType
- Types used in MIR.
- OptLevel
- Optimization level for the compiler.
- Terminator
- A block terminator instruction.
- Value
- An SSA value in the MIR.
Constants§
- IMMUTABLE_
SCRATCH_ BASE - Constructor scratch memory used to stage immutable words before appending them to runtime bytecode.
Traits§
- Backend
- A code generation backend that lowers MIR to a target artifact.
Functions§
- parse_
evm_ ir_ module - Parses an EVM IR module from the text format.