This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
solx is an optimizing Solidity compiler for EVM, developed by Matter Labs and Nomic Foundation. It uses a custom LLVM backend with an EVM target to generate optimized bytecode. The project is in beta.
Three-repository structure via git submodules:
- solx (this repo) — Rust workspace: CLI, compilation pipeline, LLVM IR generation
- solx-solidity (submodule) — Fork of solc that emits Yul/EVM assembly
- solx-llvm (submodule) — Fork of LLVM with an EVM target backend
Compilation pipeline:
Solidity → solc frontend (parse, analyze) → Yul/EVM assembly → LLVM IR → LLVM optimizer → EVM bytecode
Alternative pipeline via Slang (Rust-based frontend, WIP):
Solidity → Slang (parse, analyze) → MLIR → LLVM IR → EVM bytecode
| Crate | Purpose |
|---|---|
solx |
CLI entry point, frontend dispatch |
solx-core |
Pipeline orchestration (standard_output_evm, standard_json_evm, yul_to_evm, llvm_ir_to_evm) |
solx-codegen-evm |
LLVM IR generation, optimization passes, bytecode assembly, linking |
solx-slang |
Alternative Rust-based Slang frontend |
solx-mlir |
MLIR-to-LLVM translation via melior |
solx-yul |
Yul lexer/parser |
solx-evm-assembly |
EVM assembly representation and ethereal IR |
solx-standard-json |
solc-compatible JSON I/O protocol |
solx-utils |
Shared types (contract names, EVM versions, hashing, CBOR metadata) |
solx-dev |
Developer tool: builds LLVM, solc, runs project tests |
solx-tester |
Integration test runner using REVM |
solx-compiler-downloader |
Downloads/verifies compiler binaries |
solx-benchmark-converter |
Benchmark analysis and comparison |
solx-solc-test-adapter |
Adapter for upstream solc tests |
Important feature split: solx-slang and solx-mlir use inkwell with llvm21-1-no-llvm-linking, while solx-codegen-evm uses llvm21-1 (links LLVM). They are excluded from default-members to avoid Cargo feature unification conflicts. Use cargo test-slang to test them.
Build the solx-dev tool first, then use it to build LLVM and solc:
cargo build --release --bin solx-dev
# Build LLVM (outputs to target-llvm/target-final/)
./target/release/solx-dev llvm build --enable-mlir
# Build solc libraries (outputs to solx-solidity/build/)
./target/release/solx-dev solc buildcargo build # debug
cargo build --release # release (outputs to target/release/solx)LLVM_SYS_211_PREFIX→./target-llvm/target-final/MLIR_SYS_210_PREFIX→./target-llvm/target-final/TABLEGEN_210_PREFIX→./target-llvm/target-final/SOLC_PREFIX→./solx-solidity/build/BOOST_PREFIX→./solx-solidity/boost/lib/
cargo test # all tests (unit + CLI)
cargo test --lib # unit tests only
cargo test --test cli # CLI integration tests only
cargo test --test cli -- cli::bin::default # specific testcargo test-slang
# expands to: cargo test -p solx-slang -p solx-mlir -p solx --no-default-features --features slang --target-dir target-slangcargo build --release
./target/release/solx-tester --solidity-compiler ./target/release/solx
./target/release/solx-tester --solidity-compiler ./target/release/solx --path tests/solidity/simple/default.sol
./target/release/solx-tester --solidity-compiler ./target/release/solx --via-ir # Yul pipeline only./target/release/solx-dev test foundry --test-config-path solx-dev/foundry-tests.toml
./target/release/solx-dev test hardhat --test-config-path solx-dev/hardhat-tests.toml- Rust edition 2024, toolchain 1.93.0
missing_docswarning is enabled globally — all public items need doc comments- Release builds strip debug symbols (
strip = true) - macOS minimum deployment target: 11.0
Tests live in tests/solidity/, tests/yul/, tests/llvm-ir/.
- Simple tests (
tests/solidity/simple/): single file with//!JSON metadata comments - Complex tests (
tests/solidity/complex/): directory withtest.json+ source files - Test metadata includes:
cases,contracts,libraries,ignore,modes(Yfor Yul,Efor EVMLA)
ci:slang— enable Slang testsci:sanitizer— enable address sanitizer testsci:integration— enable integration testsci:coverage— enable code coverage