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)